Write a program that takes in an integer in the range 10 to 100 as input. Your program should countdown from that number to 0, p
rinting the count each of each iteration. After ten numbers have been printed to the screen, you should start a newline. The program should stop looping at 0 and not output that value. I would suggest using a counter to count how many items have been printed out and then after 10 items, print a new line character and then reset the counter.
important: Your output should use " %3d " for exact spacing and a space before and after each number that is output with newlines in order to test correctly.
Ex: If the input is: 10
the output is: 10 9 8 7 6 5 4 3 2 1
Ex: If the input is: 20
the output is: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
For coding simplicity, follow each output number by a space, even the last one. statement.
Use a while loop. You will need to use an if statement and some sort of decremented variable in your loop.
The skeleton code given in C programming:
#include
int main(void) {
int userNum = 0;
int counter = 0;
printf("Enter a number between 10 and 100:\n");
scanf("%d", &userNum);
if (userNum >= 10 && userNum <=100)
{
while( )
{
/* your code here */
}
}
printf("\n");