+ 1

How to find the square root of any number?

19th May 2017, 12:33 PM
Sarthak
Sarthak - avatar
2 odpowiedzi
+ 8
Or, if you don't want to include the whole module just for the sqrt function, you might calculate it by taking it to the power of 0.5: 81**.5 = 9.0, as 9**2 = 81
19th May 2017, 9:08 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
You have to include the Math headerfile. THis includes the Math class with its sqrt(double a)-Method. For example: #include <iostream> #include <Math.h> double a, result; a = 9.0; result = Math.sqrt(a); std::cout<<result;
19th May 2017, 12:45 PM
Andi