*
**
***
****
*****
#include<iostream.h>
#include<conio.h>
main()
{
int sum=3;
for(int i=-sum;i<=sum;i++)
{
for(int j=-sum;j<=sum;j++)
{
if(abs(i)+abs(j)<=sum)
{cout<<"*";}
else{cout<<" ";}
}
cout<<endl;
if(i==0)
{break;}
}
getch();
}
**
***
****
*****
#include<iostream.h>
#include<conio.h>
main()
{
int sum=3;
for(int i=-sum;i<=sum;i++)
{
for(int j=-sum;j<=sum;j++)
{
if(abs(i)+abs(j)<=sum)
{cout<<"*";}
else{cout<<" ";}
}
cout<<endl;
if(i==0)
{break;}
}
getch();
}
No comments:
Post a Comment