C Programming: Store values to the variable using the ASCII character code of a variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C Programming: Store values to the variable using the ASCII character code of a variable

I was given an assignment to input 15 numbers from user and print the numbers greater than 50. I could use array, but I need to do with using an array. So, I thought to do it in a smarter way. The way is to declare variables like a, b, c, d, ...., o and store the inputs in these variables. For that, I can use loop {a = 97 to o = 111} to store input starting from a to o ascii characters. But I got some problem in it. Can you please help me if I can write programs like this: My code: https://code.sololearn.com/cE3omPm85i9U/?ref=app

7th Nov 2020, 4:01 AM
Bibek Oli
Bibek Oli - avatar
3 Answers
+ 3
I didn't understood this line "I could use array, but I need to do with using an array"
7th Nov 2020, 4:18 AM
Arsenic
Arsenic - avatar
+ 1
Arsenic that was my school assignment. We have not studied the arrays yet. So, I need to do it without using an array.
7th Nov 2020, 5:18 AM
Bibek Oli
Bibek Oli - avatar
+ 1
Sick L̲̅i̲̅n̲̅e̲̅ B̶r̶o̶🌡️ [TheBloodCoders] it is working fine, but it is printing the number as soon as it matches the condition. How can I store the number that matches the condition in variables like a, b, c, ... and print them after entering all the values.
7th Nov 2020, 5:28 AM
Bibek Oli
Bibek Oli - avatar