How to Program to display Pyramid in C++ Programming ?
Program to display Pyramid in C++ |
/*
Program to display the following pattern:
1
212
32123
4321234
543212345
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1;i<=5;i++)
{
for(int j=4;j>=i;j--)
cout<<" ";
for(int k=i;k>=1;k--)
cout<<k;
for(int l=2;l<=i;l++)
cout<<l;
cout<<endl;
}
getch();
}
This Program to display Pyramid in C++.