Write a program to calculate the area of a triangle with sides a, b, and c.
/* Write a program to compute the area of a triangle with sides a,b,c */ #include<stdio.h> #include<conio.h> #include<math.h> int main() { float a,b,c,s,A; printf("Enter value of a, b and c.\n"); scanf("%f%f%f",&a,&b,&c); s = (a+b+c)/2; A = sqrt(s*(s-a)*(s-b)*(s-c)); printf("Area of triangle is %f",A); getch(); return 0; }
Output
For an input a=6, b=10, and c=8. Are will be 24.000000
Also, see how you can calculate the area and circumference of a circle.