# C Program to Find the Area of a Triangle

This C program calculates the area of a triangle using the formula: area = 0.5 * base * height.

## Problem statement

Write a C program to find the area of a triangle using the given base length and height.

## C Program to Find the Area of a Triangle

```#include <stdio.h>

int main() {
printf("Program to calculate the area of a triangle\n");

float base, height;
printf("Enter the base length of the triangle: ");
scanf("%f", &base);

printf("Enter the height of the triangle: ");
scanf("%f", &height);

float area = 0.5 * base * height;

printf("The area of the triangle is: %f\n", area);

return 0;
}```

## How it works

1. The program starts with an introduction message.
2. It declares two variables: `base` and `height` to store the base length and height of the triangle, respectively.
3. It prompts the user to enter the base length of the triangle.
4. The user enters the base length, which is read using the `scanf` function and stored in the variable `base`.
5. It prompts the user to enter the height of the triangle.
6. The user enters the height, which is read using the `scanf` function and stored in the variable `height`.
7. The program calculates the area of the triangle using the formula `area = 0.5 * base * height` and stores the result in the variable `area`.
8. Finally, it displays the area of the triangle using the `printf` function.