help please ='[ new to C
this is my code so far:
#include
wont show* hopefully i made sense >.<
You are assigning all of the input values for the same variable, i.e., every digit scanf reads in is allocated at user_num's memory, replacing the old one. You should create 5 different variables, like num_1, num_2, ..., num_5 (you can use an array also, it is generally better to use an array, but if you don't know about it just yet, create 5 different variables). Then, your program should determine, from the input, which one is the smallest and which one is the largest (and assign those values to two different variables, say, small and large). Only then, your loop will output every number from the smallest input to the largest, if you code it like while (small <= largest) { printf("%d\n", small); small++; }, or something like that. To check whether or not the input is outside the range 1-100, just do if (large > 100) /* code */ and if (small < 1) /* code */
ty =]
Join our real-time social learning platform and learn together with your friends!