Wednesday, 8 June 2016

Right Triangle pattern using asterisks

Code:

#include<iostream>
using namespace std;
void main()
{
//Right Triangle pattern using asterisks
int square;
cout<<"Enter The Size of Square = "; // size
cin>>square;
for(int i = 1;i<=square;i++) // outer loop
{
for(int j=1;j<=i;j++) //inner loop
{
cout<<"*"; // value that is output
}
cout<<endl;//new line for next line output
}

}



Output

No comments:

Post a Comment