C++

How To Make or Print Pyramidin C++ Programming

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++ Programming Source Code to Print Pyramid

#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 ProgramC++ Programming Source Code to Print Pyramid