+ 3

What is error in this code. ?

#include <iostream> using namespace std; int main() { float s1,s2,s3,s,area; cout<<"enter the length of three sides:"; cin>>s1>>s2>>s3; s=(s1+s2+s3)/2; area = sqrt(s*(s-s1)*(s-s2)*(s-s3)); cout<<"Area="<<area<<endl; return 0; }

17th Apr 2018, 3:12 AM
Rajesh Rathod
Rajesh Rathod - avatar
5 Answers
+ 5
add this to the top as it's needed for sqrt function: #include <math.h>
17th Apr 2018, 3:24 AM
Duncan
Duncan - avatar
+ 3
You should use <cmath> instead of <math.h>
17th Apr 2018, 7:11 AM
Alex
Alex - avatar
+ 1
Maybe it would help to do the c++ lessons Collins
17th Apr 2018, 8:51 AM
Alex
Alex - avatar
0
I don't understand what all these is all about. can someone help Me?. I want to learn C++ and I have zero knowledge of it.
17th Apr 2018, 8:47 AM
Collins
0
ok
17th Apr 2018, 10:07 AM
Collins