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

Respuesta :

Answer:

Code to this question can be described as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int n1,j,x1=0; //defining integer variable

cout<<"Enter a number: "; //print message

cin>>n1; //input value from the user

cout<<n1<<endl; //print input value

for(j=1;j<n1;j++)  //loop to count reverse number

{

x1=n1-j; //calculate value

cout<<x1<<endl;  //print value

}

return 0;

}

Output:

Enter a number: 3

3

2

1

Explanation:

  • In the above C++ language program, three integer variable "n1,j and x1" is declared, in which variable n1 take input from the user end and the variable j and x1 are used in the loop to calculate the value in the reverse order.
  • In the next step, a for loop is declared, in which the variable x1 calculates the value in reverse order and uses a print method to print its value.