Advertisement
Tahamina_Taha

Area of a triangle (base and height)

Jul 20th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. //Area of a triangle
  2. #include<stdio.h>
  3. #include<math.h>
  4. int main(){
  5.     double base,height,area;
  6.     printf("Enter base of the triangle: \n");
  7.     scanf("%lf",&base);
  8.     printf("Enter height of the triangle: \n");
  9.     scanf("%lf",&height);
  10.     area=(base*height)/2;//area of triangle=1/2(b*h)
  11.     printf("Area of the triangle  = %.2lf sq. units",area);
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement