Contact: aviboots(AT)netvision.net.il
40,904 questions
53,356 answers
573 users
#include <iostream> #include <iomanip> #include <cmath> int main() { double value = 121.0; std::cout << "The square root of " << value << " is " << std::fixed << std::setprecision(2) << sqrt(value); } /* run: The square root of 121 is 11.00 */
#include <iostream> #include <iomanip> #include <cmath> int main() { double value = 121.0; std::cout << "The square root of " << value << " is " << std::fixed << std::setprecision(2) << pow(value, 0.5); } /* run: The square root of 121 is 11.00 */
#include <iostream> #include <cmath> int main() { int a = 9; std::cout << sqrt(a) << "\n"; int b = 85; std::cout << sqrt(b); } /* run: 3 9.21954 */