How to find the area of a triangle in c program. C Program to find area of triangle given base and height. Logic to find area of a triangle in C program. C program to find area of a triangle

##
Questions: **Write a c program to input base and height of a triangle and find area of the given triangle. How to find the area of a triangle**** in c program. C program to find the area of a given base and height. Logic to find area of a triangle in c program.**

##
__Area of the triangle__

Area of the triangle is given by the formula A = hb/2 , where b is base and h is height of the triangle.

### Required knowledge & Programming Software

Arithmetic operator

Variables and expression

Data types

Basic input/output

Dev C++ /Turbo C++

Also Check:Flowchart for Area of Triangle

### Logic to find area of triangle

Steps for finding area of a triangle were discussed below:

Input base of the triangle say “b” and store in
some variable say “base”.

Input height of the triangle say “h” and store
in some variable say “height”.

Use the formula for calculating area of the
triangle, area = (base * height) / 2

Print the resultant area of the triangle.

### Program to find area of triangle

#include <stdio.h> main() { float base, height, area; /* Input base and height of triangle */ printf("Enter base of the triangle: "); scanf("%f", &base); printf("Enter height of the triangle: "); scanf("%f", &height); /* Calculate area of triangle */ area = (base * height) / 2; /* Print the resultant area */ printf("Area of the triangle = %.2f sq. units", area); }

### Example

**INPUT**

**Enter the base of the triangle: 5**

**Enter height of the triangle: 6**

**OUTPUT**

**Area of the triangle = 15 sq. units**

If you have any doubt for

**calculating area of triangle**drop a comment below and let us know our support team will get back to you as soon as possible. If you liked our content please share and subscribe to our newsletter.
## COMMENTS