3. Program to find out the area of a triangle when three sides a, b, and c of the triangle are given.


Chapter 4: 

Input And Output:

Programming Exercise:

Problem NO #3: The program finds out the area of a triangle when three sides a, b, and c of the triangle are given.


This Program is about finding out the area of the triangle when three sides a, b, and c of the triangle are given. This program is taken from this book, oop c++ book its series. From Chapter Four of this book, This program has been taken. A Program finds out the area of a triangle when three sides a, b, and c of the triangle are given.

Solution:

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

float area,s;

int a,b,c;

cout<<"Enter a three value of traingle: ";

cin>>a>>b>>c; 

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

area = sqrt(s*(s-a)*(s-b)*(s-c)); 

cout<<"Area: "<<area;

return 0;

}



OutPut:

3. Program to find out the area of a triangle when three sides a, b, and c of the triangle are given.
3. Program to find out the area of a triangle when three sides a, b, and c of the triangle are given.

Let me know in the comment section if you have any question.