Square root | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Square root

How can the square root of a number be found?

27th Aug 2019, 9:32 AM
StEvEn
StEvEn - avatar
2 Answers
0
The easiest way to do it without using functions is to exponentiate the number by 0.5 sqrt = x**0.5
27th Aug 2019, 9:46 AM
Trigger
Trigger - avatar
0
Using the <cmath> header file you can make use of the sqrt function E.g. int square_root = sqrt (int x)
27th Aug 2019, 9:58 AM
Christine