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, printing 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 76 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

What is the solution?

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, printing
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
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.
Transcribed Image Text: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, printing 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 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.
1 #include <stdio.h>
2
3 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(
{
4
7
10
11
12
/* your code here */
13
14
printf("\n");
15
16
17
return e;
18 }
19
20
Transcribed Image Text:1 #include <stdio.h> 2 3 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( { 4 7 10 11 12 /* your code here */ 13 14 printf("\n"); 15 16 17 return e; 18 } 19 20
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Fundamentals of Input and Output Performance
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education