C++ Program to Print First n Natural Number in Reverse Order using For Loop

Write C++ Program to Print First n Natural Number in Reverse Order using For Loop

// CPP Program to Print First n Natural Number in Reverse Order using For Loop

#include <iostream>

using namespace std;

int main()
{
	int n, i;

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

	cout << "\nFirst " << n << " Numbers in Reverse :--> ";
	for(i=n; i>0; i--)
	{
		cout << i << " ";
	}
    return 0;
}

Output:

Enter the number :--> 10

First 10 Numbers in Reverse :--> 10 9 8 7 6 5 4 3 2 1

≪ Previous | Next ≫