C++ Program to Print Star Pyramid Patterns

C++ Program to Create Pyramid and Pattern, print half pyramid, pyramid, invertedpyramid, Pascal’s Triangle and Floyd’s triangle using control.Hi.Today we make a Program how to make pyramid in c++make pyramid from asterik using c++.it is very Easy Lets Try to make it.

C++ Program to Print Star Pyramid Patterns

#include<iostream>
#include<iomanip>
using namespace std;
main(){
int u=1;
int space;
int i,x;
cout<<"Enter the length of the pyramid:";
cin>>x;
while(u<=x)
{
i=1;
cout<<setw(space);
while(i++<=u)
cout<<"X";
u=u+2;
space--;
cout<<endl;
}
system("pause");
}

Output of Program

*
* *
* * *
* * * *
* * * * *

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

A
B B
C C C
D D D D
E E E E E