Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Area of a triangle
- #include<stdio.h>
- #include<math.h>
- int main(){
- double base,height,area;
- printf("Enter base of the triangle: \n");
- scanf("%lf",&base);
- printf("Enter height of the triangle: \n");
- scanf("%lf",&height);
- area=(base*height)/2;//area of triangle=1/2(b*h)
- printf("Area of the triangle = %.2lf sq. units",area);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement