Example
Input :
Input rows: 5
Output :
********* ******* ***** *** *
Required Knowledge
Basic C++ programming, for loop, if-else, nested loop
Program to print reverse pyramid star pattern
/* C++ program to print reverse pyramid star pattern */ include <iostream> using namespace std; int main() { int i, j, rows;/* Input rows to print from user */
cout<<"Enter number of rows : ";
cin>>rows;
for(i=1; i<=rows; i++)
{
/* Print leading spaces */
for(j=1; j<i; j++)
{
cout<<" ";
}
/* Print stars */
for(j=1; j<=(rows*2 -(2*i-1)); j++)
{
cout<<"*";
}
/* Move to next line */
cout<<"\n";
}
return 0;
}