Ask Question

Write code that prints: Ready! userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: userNum = 3 outputs: Ready! 3 2 1 Blastoff!

+4
Answers (1)
  1. 7 October, 18:56
    0
    The program to this can be described as follows:

    Program:

    #include / /defining header file

    using namespace std;

    int main () / /defining main method

    {

    int number, l, value=0; / /defining integer variables

    cout<<"UserNum = "; / /print message

    cin>>number; / /input value by user-end

    cout<<"Ouput: Ready!"<
    for (l=1; l
    {

    value=number-l; / /calculate value

    cout<
    }

    cout<<"Blastoff!"; / /print message

    return 0;

    }

    Output:

    UserNum = 3

    Ouput: Ready!

    3

    2

    1

    Blastoff!

    Explanation:

    Description of the above code:

    Three integer variable "number, l, and value=0" is defined in this program, in which the number variable takes input from the end and the variable l and value is used in the loop to calculate the value in reverse order. In the for loop is declared, a variable value is defined, which calculates the value in reverse order and uses a print method to print the value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write code that prints: Ready! userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after ...” 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