Sunday 21 December 2014

Diamond Pattern

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,l,m,n;
for(i=1;i<=5;i++)
{
for(j=5-i;j>=1;j--)
cout<<" ";
for(k=1;k<=i;k++)
cout<<"# ";
cout<<endl;
}
for(l=4;l>=1;l--)
{
for(m=5-l;m>=1;m--)
cout<<" ";
for(n=1;n<=l;n++)
cout<<"# ";
cout<<endl;
}
getch();
}

No comments:

Post a Comment