C++ Online Compiler
Example: C++ program to calculate the square root of a number using the pow() function
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to calculate the square root of a number using the pow() function #include <iostream> #include <cmath> // to import the pow() function using namespace std; int main() { double n, r; // n = number // r = root cout << "Enter any number to find the square root::\n"; cin >> n; /* Calculate square root of number */ r = pow(n, 0.5); // Output cout << "Square root of " << n << " = " << r; return 0; }
25
Output
Clear
ADVERTISEMENTS