C++ Program to print pyramid [DEVCPP/GCC]

PROGRAM

//Program to print pyramid

#include<iostream>

using namespace std;

int main()
{
int i,j,n,k;
cout<<"ENTER NUMBER OF ROWS\n";
cin>>n;

cout<<"\nOUTPUT:\n";

for(i=1 ; i<=n ; i++)
{
for(j=(n-i) ; j>0 ; j--)
cout<<" ";

for(k=1 ; k<(2*i) ; k++)
cout<<"*";

cout<<endl;
}

return 0;
}

OUTPUT

C++ Program to print pyramid with output

Share this

Related Posts

FIND US ON FACEBOOK!