:rolleyes: i have to write a program which ask the user the height of a pyramid between 1 and 15 and displays a pyramid of this height made up of "*" characters on screen.for example
how high would you like the pyramid?:37
pick another height(must be between 1 and 15):6
**
****
******
********
**********
************
i have written the following but its displaying something like that
**
**
**
**.........
it continues like that for the number of * that is suppose to made the pyramid
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
int h,i;
cout<<"how high would you like the pyramid?";
cin>>h;
ch='*';
if(h>15)
cout<<"pick another height between 1 and 15"<<endl;
cin>>h;
if((h>=1)&&(h<15))
for(i=1;i<=h;i++)
{
for(int a=1;a<=i;a++)
{ cout<<ch<<ch<<endl; }
}
getch();
}