1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex787 [66]
3 years ago
12

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 cổunt 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. In C please
Computers and Technology
1 answer:
antoniya [11.8K]3 years ago
6 0

Answer:

The program written in C language is as follows

#include<stdio.h>

int main()

{

//Declare digit

int digit;

//Prompt user for input

printf("Enter any integer: [10 - 100]: ");

scanf("%d", &digit);

//Check if digit is within range 10 to 100

while(digit<10 || digit >100)

{

printf("Enter any integer: [10 - 100]: ");

scanf("%d", &digit);

}

//Initialize counter to 0

int counter = 0;

for(int i=digit;i>0;i--)

{

 printf("%3d", i); //Print individual digit

 counter++;

 if(counter == 10) //Check if printed digit is up to 10

 {

  printf("\n"); //If yes, print a new line

  counter=0; //And reset counter to 0

 }

}

}

Explanation:

int digit; ->This line declares digit as type int

printf("Enter any integer: [10 - 100]: "); -> This line prompts user for input

scanf("%d", &digit);-> The input us saved in digit

while(digit<10 || digit >100) {

printf("Enter any integer: [10 - 100]: ");

scanf("%d", &digit); }

->The above lines checks if input number is between 10 and 100

int counter = 0; -> Declare and set a counter variable to 0

for(int i=digit;i>0;i--){ -> Iterate from user input to 0

printf("%3d", i); -> This line prints individual digits with 3 line spacing

counter++; -> This line increments counter by 1

if(counter == 10){-> This line checks if printed digit is up to 10

printf("\n"); -> If yes, a new line is printed

counter=0;} -> Reset counter to 0

} - > End of iteration

You might be interested in
WILL GIVE BRAINLIEST!!!!!!!!!
sukhopar [10]

Answer:

True

Explanation:

7 0
3 years ago
Write a calculator program that will allow only addition, subtraction, multiplication &amp; division. Have the
ozzi

num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: "))

operation = input("Which operation are you performing? (a/s/m/d) ")

if operation == "a":

   print("{} + {} = {}".format(num1, num2, num1+num2))

elif operation == "s":

   print("{} - {} = {}".format(num1, num2, num1-num2))

elif operation == "m":

   print("{} * {} = {}".format(num1, num2, num1*num2))

elif operation == "d":

   print("{} / {} = {}".format(num1, num2, num1/num2))

I hope this helps!

8 0
2 years ago
Citations that are ______________________________ can be used to build a bibliography when needed. [Create and Modify Citation S
VMariaS [17]

Answer:

I think the best option would be C. Marked

Explanation:

hope this helps and sorry if it is incorrect.

8 0
3 years ago
Please please help I don’t understand this
garik1379 [7]

Answer:

It is this because yass

Explanation:

And yes

6 0
2 years ago
Read 2 more answers
What important advice to include about spyware, viruses and other types of malware
S_A_V [24]

Answer:

You should probably include the fact that most of these things will disguise themselves as fake downloads and that will most of the time claim to allow you to download something that costs money for free.

Explanation:

thats all i could come up with

5 0
2 years ago
Read 2 more answers
Other questions:
  • Where are the instructions stored that the computer needs when it is switched on?
    7·1 answer
  • 5. Why are female fans particularly valuable to the sports industry? Cite two<br> specific reasons.
    11·1 answer
  • Nathan took a picture of his friends while they were on a field trip. He wants upload this picture to a photo-sharing site. He w
    7·1 answer
  • Varun wants to start his own business. Suggest him at least four functions of an entrepreneur.
    8·2 answers
  • The state licensing bureau recently conducted a survey at Community Hospital. During this review, the surveyors determined that
    13·1 answer
  • When searching the web software programs called fetch a few web pages and then they follow the links on those pages and fetch th
    9·2 answers
  • ............................... ?
    11·1 answer
  • You are to calculate the property tax for tax payers. You will ask the county tax clerk if they want to run the program and init
    9·1 answer
  • Text,Audio and graphic is entered into the computer using
    9·1 answer
  • Innovation made from establishment of abucas to the present 5th
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!