Ask Question

How do you get a code in C to count down from 5?

+1
Answers (1)
  1. 24 January, 08:33
    0
    This is what the code should do:

    "Lift off in T minus

    5

    4

    3

    2

    1

    Blast-off!"

    When I run it, it just keeps printing ''Sum = 5'' forever.

    Explanation:

    Code:

    int main (void) {

    int sum = 5;

    int i;

    printf ("Lift off in T minus/n");

    for (i = 0; i < 5; i=i+i) {

    sum = sum - i;

    printf ("sum = %d/n", sum);

    }

    printf ("Blast-off", sum);

    return 0;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “How do you get a code in C to count down from 5? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers