Wednesday, 24 July 2013

PROGRAM TO PRINT THE BLANK PYRAMID

//PROGRAM TO PRINT THE BLANK PYRAMID
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int i,j,k,n,p;
    cout<<"\nenter the number of rows\n";
    cin>>n;
    for(i=1;i<n;i++)
    {
        for(j=1;j<=n-i;j++)
            cout<<" ";
        for(k=1;k<=2*i-1;k++)
        {
            if(k==1||k==2*i-1)
                cout<<"*";
            else
                cout<<" ";
            if(k==2*(n-1)-1)
            {
                cout<<endl;
                for(i=1;i<=n;i++)
                    cout<<"* ";
            }
        }
        cout<<endl;
    }
    return 0;
}

No comments:

Post a Comment