What should I use to calculate radical? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What should I use to calculate radical?

I tried: a^(1/2) and a^(0.5) but it didn't work

25th Jan 2018, 11:48 AM
Mohammadmahdi Sefatzadeh
Mohammadmahdi Sefatzadeh - avatar
2 Answers
+ 2
Use std::pow(a, 0.5). Omit the "std::" if you are "using namespace std". Remember to include <cmath>. If you just want to calculate the square root there is std::sqrt(a), also in cmath.
25th Jan 2018, 12:22 PM
Vlad Serbu
Vlad Serbu - avatar
0
Thanks
25th Jan 2018, 12:25 PM
Mohammadmahdi Sefatzadeh
Mohammadmahdi Sefatzadeh - avatar