English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C Library Function double sqrt(double x) Returns x square root.
Below is the declaration of the sqrt() function.
double sqrt(double x)
x -- Floating-point value.
This function returns the square root of x.
This example demonstrates the usage of the sqrt() function.
#include <stdio.h> #include <math.h> int main() { printf("%lf's square root is %lf\n", 54.0, sqrt(54.0)); printf("%lf's square root is %lf\n", 38.0, sqrt(38.0)); printf("%lf's square root is %lf\n", 8.0, sqrt(8.0)); return(0); }
Let's compile and run the above program, which will produce the following result:
54The square root of .000000 is 7.348469 38The square root of .000000 is 6.164414 8The square root of .000000 is 2.828427