Dremendo Tag Line

Print first 20 natural numbers in reverse order using for loop in C++

for Loop - Question 2

In this question, we will see how to print the first 20 natural numbers in reverse order in C++ programming using for loop. To know more about for loop click on the for loop lesson.

Q2) Write a program in C++ to print the first 20 natural numbers in reverse order using for loop.

Program

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    int i;

    for(i=20; i>=1; i=i-1)
    {
        cout<<i<<" ";
    }
    return 0;
}

Output

20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1 
video-poster