===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int n,i,j,k,m,b;
cout<<"Enter number: ";
cin>>n;
b=n-1;
clrscr();
for(k=1;k<=b;k++)
cout<<" ";
cout<<"* ";
cout<<"\n";
b=b-1;
for(i=1;i<=n-2;i++)
{
for(j=1;j<=b;j++)
cout<<" ";
cout<<"* ";
for(j=1,m=1;j<=i-1;j++)
m=m+2;
for(j=1;j<=m;j++)
cout<<" ";
cout<<"*\n";
b=b-1;
}
for(k=1;k<=m+4;k++)
cout<<"* ";
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int n,i,j,k,m,b;
cout<<"Enter number: ";
cin>>n;
b=n-1;
clrscr();
for(k=1;k<=b;k++)
cout<<" ";
cout<<"* ";
cout<<"\n";
b=b-1;
for(i=1;i<=n-2;i++)
{
for(j=1;j<=b;j++)
cout<<" ";
cout<<"* ";
for(j=1,m=1;j<=i-1;j++)
m=m+2;
for(j=1;j<=m;j++)
cout<<" ";
cout<<"*\n";
b=b-1;
}
for(k=1;k<=m+4;k++)
cout<<"* ";
getch();
}
===========================================================================
No comments:
Post a Comment