Question #187613

Using for loop, how to write a program that accepts a positive integer n, representing the number of seconds before the rocket will launch. The program should then output the numbers from n going down to 0. After the line containing the 0, the program should output another line with the words “Blast Off!”

Expert's answer

#include <stdio.h>

int main() {
    int n; 
    scanf("%d", &n);
    while (n >=0) {
        printf("%d\n", n);
        n--;
    }
    puts("Blast Off!");
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS