Ask Question

Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.

+3
Answers (1)
  1. 20 May, 02:46
    0
    Following are the program in c+ + langauge

    #include

    using namespace std; / / namespace

    int main () / / main function ()

    {

    int n1; / / variable declaration

    cout<<"Enter the number between 20 and 98 : ";

    cin>>n1; / / Read the value by user

    cout<<" The output is given : 93 92 90 89 88

    Explanation:

    Read the value by user in the n1 variable of int type";

    if (n1 98) / / checking the condition

    {

    cout<<" input must be between the 20-98";

    }

    else

    {

    cout<
    while (n1 % 11! = 0) / / itearting over the loop

    {

    n1 = n1 - 1; / / decrement the value of n1 by 1

    cout<<" "<< n1; / / didplay the n1

    }

    }

    }

    Output:

    Enter the number between 20 and 98 : 93

    The output is given : 93 92 90 89 88

    Explanation:

    Following are the description of the program

    Read the value by user in the "n1" variable of int type. In the if block checking the range of input. If the user puts the correct range then control goes to the else block and calculating the countdown.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping ...” 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