Write a program that inputs base and height from the user and calculates area of a triangle by using the formula Area = Base Height.
Program
#include <stdio.h>
#include <conio.h>
float base, height
double area
clrscr():
printf("Enter base"):
scanf("%f", &base)
printf("Enter height:"):
Scanf(%f"', &height);
area 0.5 * base * height
printf("Area = %5.2f", area);
getch()
}
Output:
void main()
Enter base: 10.5
Enter height: 5.4
Area = 28.35

Comments
Post a Comment