1 2 3 4 5 6 7 8 9 10 11 12 | #include <stdio.h> #include <math.h> int main() { float a, b, c, p, area; printf("Please enter the three sides of a triangle: a= ,b= ,c= \n"); scanf("a=%f,b=%f,c=%f", &a, &b, &c); p = (a + b + c)/2; area = sqrt(p * (p - a) * (p - b) * (p - c)); printf("The area of the triangle is: %.2f\n", area); return 0; } |