WAP to enter the three sides of a triangle(a,b &c) and print its area using heron's formula: s=(a+b+c)/2 area=√s(s-a)(s-b)(s-c)
Answers
Answered by
4
Note: I am using C++ programming language.
#include<iostream>
#include<math.h>
using namespace std;
float CalArea(float a, float b,float c ) {
float s = (a+b+c)/2 ;
float area = sqrt(s*((s-a)*(s-b)*(s-c))) ;
return area ;
}
int main ( ) {
float a,b,c;
cout<<"Enter lengths of sides of the triangle :\n" ;
cin>>a>>b>>c;
cout<<"\n\nArea of the triangle is " <<CalArea(a,b,c) ;
return 0 ;
}
**Please mark this as Brainliest answer!
Similar questions