Program in c++ that reads two numbers and print all number in descending order using loop

 


c++ language
c++ language



    write a programme in c++ that reads two numbers(smaller first than larger) then print all numbers in descending order from larger to smaller numbers that comes in between using loop.

programe:

1)#include<iostream>

2)using namespace std;

3)int main()

4){

5)int x;

6)int y;

7)cout<<"input first number";

8(cin>>x;

9)cout<<"input second number";

10)cin>>y;

11)if(x<y)

12)for(int i=y;i>=x;i--)

13)cout<<i<<endl;

14)else

15)cout<<"invalid input";

16)return 0;

17)}

Description:

    write a programme in c++ that reads two numbers(smaller first than larger) then print all numbers in descending order from larger to smaller numbers that comes in between using loop.This is a c++ programe in c++ language format.This programe uses loops to solve this in c++ language.while  loop,for loop,do-while loop is used to solve this.c++ language programming is an object oriented programming.This can also be solved by python,javascript or any other language.

Post a Comment

0 Comments