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

## 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++

### 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.

Name

99% fails,59,Algebra,3,Algorithm,3,brain teaser,15,brain teasers riddles,15,C-Programming,5,calculus,5,capacitance,1,Capacitance and Capacitor,1,Capacitance and Capacitor - Defination,1,capacitance unit,1,Capacitor,1,capacitor unit,1,easy riddles,15,electronics,1,Equation & Examples,1,flowchart,2,Function,5,logic puzzles,43,Mapping,3,math puzzle for adult,44,math puzzle for kids,44,math puzzle with sticks,1,maths puzzle whatsapp,44,maths puzzles for class 4 pdf,1,maths puzzles games,44,maths puzzles with answers,44,number puzzles,43,Physics,1,printable math brain teasers,43,riddle websites,15,riddles and puzzles,15,riddles for adults,15,riddles for kids,15,riddles hard,15,riddles with answer,15,Root,2,science,1,sets,5,short riddles,15,simple maths puzzles,43,Square,2,tricky riddles with answers,15,
ltr
item
MathZAG: C program to find area of a triangle
C program to find area of a triangle
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
https://2.bp.blogspot.com/-Illyyjqap84/Wv8nTj4kFFI/AAAAAAAABQo/4aBWhm3zJi4XCOy1D_kj_lbB_KiO_kRSACLcBGAs/s1600/area%2Bof%2Btriangle.png
https://2.bp.blogspot.com/-Illyyjqap84/Wv8nTj4kFFI/AAAAAAAABQo/4aBWhm3zJi4XCOy1D_kj_lbB_KiO_kRSACLcBGAs/s72-c/area%2Bof%2Btriangle.png
MathZAG
https://www.competativestudy.com/2018/05/c-program-to-calculate-area-of-triangle.html
https://www.competativestudy.com/
https://www.competativestudy.com/
https://www.competativestudy.com/2018/05/c-program-to-calculate-area-of-triangle.html
true
2375945666816187403
UTF-8