Example
Input :
Input rows: 5
Output :
* ** *** **** *****
Required Knowledge
Basic C++ programming, For loop, nested loop
Program to print mirrored right triangle star pattern
include <iostream>
using namespace std;
/*
* Siddharth Goyal
* Chandigarh Engineering College, Landran
*
*/
int main(){
int i, j, rows;
/* Input rows from user */
cout<<"Enter number of rows: ";
cin>>rows;
/* Iterate through rows */
for(i=1; i<=rows; i++){
for(j=i; j<rows; j++){
cout<<" ";
}
/* Print star in increasing order or row */
for(j=1; j<=i; j++){
cout<<"*";
}
/* Move to next line */
cout<<"\n";
}
return 0;
}
