How to find sqrt roots of an quadratic equation in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find sqrt roots of an quadratic equation in c++

write down

21st Jan 2018, 7:27 PM
Ankit Verma
Ankit Verma - avatar
2 Answers
+ 1
You can use the function sqrt() defined in the <cmath> header file to compute square roots. Just include the header in your program to use it. Link: http://www.cplusplus.com/reference/cmath/sqrt/ On the other hand, you could make your own function. Here is an example on how to do that (not my own though): https://code.sololearn.com/c8S3I68d2mv5/?ref=app
21st Jan 2018, 7:36 PM
Shadow
Shadow - avatar
0
#include <cmath> int a = 36; cout << sqrt(a); Output: 6
21st Jan 2018, 7:43 PM
Anton
Anton - avatar