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

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.
area-of-triangle-c-programming

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 

area-of-triangle-c-programming

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

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
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy