The Tech Platform

Jun 26, 20211 min

Write a Program to Find the Area of Triangle in C

Code:

#include<stdio.h>
 

 
int main()
 
{
 
int h, b;
 
float area;
 
printf("\nEnter the height of the Triangle: ");
 
scanf("%d", &h);
 
printf("\nEnter the base of the Triangle: ");
 
scanf("%d", &b);
 
area = (h*b)/(float)2;
 
printf("\n\n\nThe area of the triangle is: %f", area);
 
return 0;
 
}

Output:

The Tech Platform

www.thetechplatform.com

    0