C++ Program to Print First N Numbers in Reverse Order using While Loop

Write C++ Program to Print First N Numbers in Reverse Order using While Loop

// CPP Program to Print First N Numbers in Reverse Order using While Loop

#include <iostream>

using namespace std;

int main()
{
	int n;

	cout << "Enter the number :--> ";
	cin >> n;

	int i = n;

	while(i > 0)
	{
		cout << i << endl;;
		i--;
	}
    return 0;
}

Output:

Enter the number :--> 5
5
4
3
2
1

≪ Previous | Next ≫