anonymous
  • anonymous
help please ='[ new to C this is my code so far: #include #include int main() { int user_num; printf("enter num: "); scanf("%d%d%d%d%d", &user_num,&user_num,&user_num,&user_num,&user_num); while (user_num >=1 && user_num <= 100) { printf("%d\n", user_num); user_num++; } return 0; } what i need to do is have the user input 5 numbers from 1- 100. for ex. 10,15,50,45,2 now smallest number to the biggest number must be the output 2 3 4 5 6... 10... 15 16... 50 #s outside the range of 1-100 won
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
wont show* hopefully i made sense >.<
anonymous
  • anonymous
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 */
anonymous
  • anonymous
ty =]

Looking for something else?

Not the answer you are looking for? Search for more explanations.