Draw a triangle with a symbol of a given height.
Code in C++
#include<iostream.h>
#include<conio.h>
void main()
{
int r, c, h;
clrscr();
cout << "\n Enter the height: ";
cin >> h;
clrscr();
for(r=1;r<=h;r++)
{
for(c=h-r+1;c<=h;c++)
{
gotoxy(c, r);
cout << "*";
}
}
getch();
}