Program to print pattern of stars till N number of rows (Level - High)

Program # 27: Program to pattern of stars till N number of rows

//Program to print pattern of stars till N number of rows (Level - High)

#include <iostream>
using namespace std;

int main()
{
clrscr();

int i, space, rows, m=0;

cout<<"Enter the number of rows: ";
cin>>rows;

for(i=1; i<=rows; i++)
{
for(space=1; space<=rows-i; space++)
{
cout<<" ";
}
while(m!=(2*i-1))
{
cout<<"* ";
m++;
}
m=0;
cout<<"\n";
}

return 0;
}

Post a Comment

0 Comments