Monday 24 August 2020

Inverted half pyramid using numbers using CPP

Source Code : 

#include<iostream>
using namespace std;
int main()
{
int rows;
cout<<"Enter number of rows: ";
cin>> rows;
for(int i = rows; i >= 1; --i)
{
for(int j = 1; j <= i; ++j)
{
cout << j << " ";
}
cout << endl;
}
return 0;
}

Program Output :




No comments:

Post a Comment