Tuesday, November 26, 2013

Star Pyramid with while loop















>>>>>>>>>>>The Code<<<<<<<<<<<<<<<

#include <iostream>
using namespace std;
void main()
{
   
    int x,row,y=0;
    cout<<"Enter number of rows"<<endl;
    cin>>row;
    row=row*2;


    while(y<row)
    {
        ++y;
        int x=row;
        while(x>y)
        {   
            x=x-2;
            cout<<" ";
        }
       
        int z=0;
          while(z<y)
        {   
            z=z++;
            cout<<"*";
        }
        y++;
        cout<<endl;
   
    }

    //coded by cppfuzz.com

}

Widgets

 

Copyright @ 2014 CPP Fuzz.