You must have read about triangles and Areas in math, and you would also know how to calculate the area of a triangle, but probably many of you would not know how to write the code to calculate the area of a triangle.

That’s why in this post I will tell you how to find the area of a triangle, and that too in the form of coding.

To calculate the area of a triangle, we will need two things: the height of the triangle and the base.

**Formula of Area Of Triangle**

Area = (base * height) / 2

**C Program to calculate the area of a triangle**

```
/*program of finding area of a triangle using c language without using a function*/
#include <stdio.h>
int main()
{
float height, base, area;
printf("Enter the height of the triangle: ");
scanf("%f", &height);
printf("Enter the base of the triangle: ");
scanf("%f", &base);
// Formula for Calculating area of a Triangle = (base * height) / 2
area = (base * height) / 2;
printf("The area of the triangle is: %.2f\n", area);
return 0;
}
```

**Summary**

If you want to learn similar programming questions and concepts in an easy language, then you can explore our site, where you will find a lot of content.

Similar articles