If length of three sides of a triangle of a triangle are input through the keyboard, Write a program to find the area of the triangle. - Code With Friends

Home Top Ad

Search Your Questions

Friday, February 22, 2019

If length of three sides of a triangle of a triangle are input through the keyboard, Write a program to find the area of the triangle.

#include <stdio.h>
#include <math.h>

int main()
{
    int s, sidea, sideb, sidec, area;

    printf("Enter the side of triangle a, b and c \n");
    scanf("%d %d %d", &sidea, &sideb, &sidec);

    s = (sidea + sideb + sidec) / 2;
    area = sqrt(s * (s - sidea) * (s - sideb) * (s - sidec));
    printf("Area of a triangle = %d \n", area);
}

No comments:

Post a Comment