AIM:

        To write a C program to find the area of a triangle given the length of three sides.

ALGORITHM:

Step 1: Start the program.

Step 2: Read the side lengths a, b and c.

Step 3 : Calculate area using the formula

area = √s(s-a)(s-b)(s-c)

where s = (a + b + c)/ 2

Step 4: Print the area.

Step 5: Stop the program.

PROGRAM CODE:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{ float a,b,c, s, area; clrscr(); printf("nEnter the length of the three sides of the triangle:"); scanf("%f%f%f",&a,&b,&c); s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); printf("nArea of the Triangle :%.3f sq.meters",area); getch();
}
OUTPUT:

triangle

RESULT:

                    Thus the C program to find the area of a triangle is written and executed  successfully.

Similar Posts