C Online Compiler
Example: C program to calculate the square root of a number by using the pow() function
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C program to calculate the square root of a number by using the pow() function #include <stdio.h> #include <math.h> // to import the pow() function int main() { double n, r; // n = number // r = root printf("Enter any number to find the square root::\n"); scanf("%lf\n", &n); /* Calculate square root of number */ r = pow(n, 0.5); // Output printf("Square root of %.2lf = %.2lf", n, r); return 0; }
25
Output
Clear
ADVERTISEMENTS