Tuesday, April 3, 2012

Program to generate Pyramid of any given number


#include<iostream.h>
#include<conio.h>
main()
{
int i,j,k,n;
clrscr();
cout<<"Enter any number";
cin>>n;
int l=n;
for(i=1;i<=n;i++)
{
for(k=l;k>=0;k--)
{
cout<<" ";


}
for(j=1;j<=i;j++)
{
cout<<j<<" ";
}
cout<<endl;
l--;
}
getch();
}
/************<soeasyprograms.blogspot.in>***************/

Output of this program is:



No comments:

Post a Comment