Program or code in ‘C’ to input the height of the triangle and draw a reverse triangle.
Draw a reverse triangle
#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 <= 40 - r; c++)
printf(" ");
for (c = r; c >= 1; c--)
printf("%d", c);
}
getch();
}