C program - find area of a triangle
C program for how to find area of a triangle.
by Krishna viswambharan
Posted on 07 Aug 2017 Category: C
Views: 796
Edited on 09 Aug 2017
Code for how to find area of a triangle
#include <stdio.h>
#include <conio.h>
void main()
{
int h,b; //variable declaration
float area;
printf("Enter the height of the triangle :");
scanf("%d",&h); // read the height of the triangle
printf("Enter the base of the triangle :");
scanf("%d",&b); // read the base value
area=0.5*h*b; //formula to calculate the area
printf("Area of the triangle = %d", area); //result
getch();
}
Output