66.3k views
3 votes
c programming Write code that prints: Ready! countNum ... 2 1 Go! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: countNum = 3 outputs: Ready! 3 2 1 Go! 1 2 3 4 5 6 7 8 9 10 11 12 13 #include int main(void) { int countNum; int i; countNum = 3; /* Your solution goes here */ return 0; } 1 2 3 4 5 Check Next

1 Answer

4 votes

Answer:see explanation

Step-by-step explanation:

Hello, from your question I see that you need a program which based on countNum's value prints ready then all the numbers to 1 and finally go!, I'd appreciate if you provided information about the numbers after the example you gave as I do not know if they are to be printed too.

The solution I provide includes the countdown to 1 printing newline after each number and text. Try it out!

#include <stdio.h>

int main(void)

{

int countNum;

int i;

countNum = 22;

for ( i = countNum; i > 0; i--) {

if (i == countNum){

printf("Ready!\\");

}

printf("%d\\",i);

}

printf("Go!\\");

return 0;

}

User MrBean Bremen
by
5.8k points