Star pattern 4
#include<iostream>
using namespace std;
int space;
int row=5;
int main(){
for( int i=1;i<=5;i++){
for(space=1;space<=(row-i);space++)
{
cout<<" ";
}
for (int j=1;j<=i;j++)
{
cout<<"* "; // add some space just after star
}
cout<<"\n";
}
return 0;
}
Comments
Post a Comment