22nd Jul 2021, 3:33 PM
Hayat🙃
Hayat🙃 - avatar
5 Antworten
+ 2
hita adam Include math.h or cmath for sqrt and there is no sqr so do (b * b) instead of sqr(b) or you can also use pow method to get power like this pow(b, 2) https://code.sololearn.com/cM3p9SLpvrGZ/?ref=app
22nd Jul 2021, 3:47 PM
A͢J
A͢J - avatar
+ 1
sqrt stands for square root sqrt(4) is √4 (mathematical notation) which is equal to 2 (school maths)
22nd Jul 2021, 3:34 PM
minirkk
minirkk - avatar
+ 1
Thanks
22nd Jul 2021, 3:49 PM
Hayat🙃
Hayat🙃 - avatar
0
// fixed code - you forgot to include math.h and also there's a typo with sqrt spelling and also imbalanced parenthesis issue #include <iostream> #include <math.h> #include <iomanip> using namespace std; int main () { double a, b, c, x1, x2; cin >> a >> a >> c; x1=(-b+sqrt(sqrt(b)-4*a*c)/2*a); x2=(-b-sqrt(sqrt(b)-4*a*c)/2*a); cout << "first root=" << x1 << endl; cout << "second root=" << x2 << endl; return 0; }
22nd Jul 2021, 3:38 PM
minirkk
minirkk - avatar
0
Ok
22nd Jul 2021, 3:45 PM
Hayat🙃
Hayat🙃 - avatar