Program to find the Area of any Triangle having values of three sides

Program to find the Area of any Triangle having values of three sides
Di Posting Oleh : Simple Learning
Kategori : area of triangle find area of triangle having values of three sides heron's formula

To find the area of any triangle in which values of three sides are given we can use Heron's formula

which is equal to:

Note: To apply Heron's formula there should be values of all three sides of a triangle.

C++ Program to find the area of any triangle using Heron's Formula

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

    float first,second,third;

    float s,area;

    cout<<"Enter size of each sides of triangle"<<endl;

    cout<<"Enter size for First Side =";

    cin>>first;

    cout<<"Enter size for Second Side =";

    cin>>second;

    cout<<"Enter size for Third Side =";

    cin>>third;

    s = (first+second+third)/2;

    area = sqrt(s*(s-first)*(s-second)*(s-third));

    cout<<"Area of Triangle= "<<area<<endl;

    return 0;

}

Sample Output:



 Image view of  Code:

0 Response to "Program to find the Area of any Triangle having values of three sides"

Post a Comment