Build your programming skills and logic in “C” language.
Question
To input the height of the triangle and draw the triangle on screen.
Solution Code
#include<stdio.h>
#include<math.h>
#include<conio.h>
main()
{
int h,r,c;
clrscr();
printf("\n Enter the height of the triangle: ");
scanf("%d",&h);
for (r=1; r<=h; r++)
{
printf("\n");
for (c=1; c<=r; c++)
printf(" %d",c);
}
getch();
}