//Design 3
#include<iostream>
#include<conio.h>
using namespace std;
int main(void)
{
int i,j,x=1;
for(i=0;i<=5;i++)
{
for(j=5;j>i;j--)
{
cout.width(3);
cout<<" ";
}
for(j=0;j<i;j++)
{
if((i==3) && (j==1))
{
cout.width(5);
cout<<"2"<<" ";
}
else if((i==4) && ((j==1)||(j==2)))
{
cout.width(5);
cout<<"3"<<" ";
}
else if((i==5) && ((j==1) || (j==3)))
{
cout.width(5);
cout<<"4"<<" ";
}
else if((i==5) && (j==2))
{
cout.width(5);
cout<<"6"<<" ";
}
else
{
cout.width(5);
cout<<x<<" ";
}
}
cout<<endl;
}
getch();
}
No comments:
Post a Comment
Comments please: