C++ Program to display pyramid using *
//C++ Program to display pyramid using *
//header files
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int space, rows;
cout <<"Enter number of rows: ";
cin >> rows;
for(int i = 1, k = 0; i <= rows; ++i, k = 0)
{
for(space = 1; space <= rows-i; ++space)
{
cout <<" ";
}
while(k != 2*i-1)
{
cout << "* ";
++k;
}
cout << endl;
}
getch();
}
Output