#include<iostream.h>
void main()
{
int i,j,n,k;
cout<<"\Enter the number of lines to be printed: ";
cin>>n;
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
cout<<"*";
}
for(k=0;k<(2*n-2*j);k++)
{
cout<<" "; //for spaces
}
for(j=0;j<n-i;j++)
{
cout<<"*";
}
cout<<"\n";
}
}
No comments:
Post a Comment