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