# C Program to Find Area of a Right Angled Triangle

This is a C Program to find area of a right angled triangle.

Problem Description

This C Program calculates the area of a right angled triangle.

Problem Solution

The formula used in this program are Area = (1/2) * height * width.

Program/Source Code

Here is source code of the C Program to Find the area of a right angled triangle.The C program is successfully compiled and run on a Linux system. The program output is also shown below.

```/*
* C Program to Find Area of a Right Angled Triangle
*/
#include <stdio.h>

int main()
{
float height, width;
float area;

printf("Enter height and width of the given triangle:\n ");
scanf("%f%f", &height, &width);
area = 0.5 * height * width;
printf("Area of right angled triangle is: %.3f\n", area);
return 0;
}```
Program Explanation

In this C program, library function defined in <math.h> header file is used to compute mathematical functions. We are reading the ‘height’ and ‘width’ of a triangle. To find the surface area, the following formulas is used.

Area = (1/2) * height * width.

Runtime Test Cases
```
Output:
\$ cc pgm24.c
\$ a.out
Enter height and width of the given triangle:
10 15
Area of right angled triangle is: 75.000```

Sanfoundry Global Education & Learning Series – 1000 C Programs.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

Here’s the list of Best Books in C Programming, Data-Structures and Algorithms

If you wish to look at other example programs on Mathematical Functions, go to C Programming Examples on Mathematical Functions. If you wish to look at programming examples on all topics, go to C Programming Examples. 