Home  >  Article  >  Backend Development  >  Usage of sqrt function in C language

Usage of sqrt function in C language

angryTom
angryTomOriginal
2020-02-06 13:29:4811564browse

Usage of sqrt function in C language

Usage of sqrt function in c language

The sqrt function is used to calculate the square root of a non-negative real number. The function prototype of

sqrt: The function prototype of the math.h header file in VC6.0 is double sqrt(double);

Note: sqrt is Square Root Calculations. This operation can test the floating point capability of the CPU.

Header file: math.h

Program example:

#include <math.h>
#include <stdio.h>
int main(void)
{
    double x = 4.0, result;
    result = sqrt(x); //result*result = x
    printf("The square root of % is %\n", x, result);
    return 0;
}

Recommended learning:c language video tutorial

The above is the detailed content of Usage of sqrt function in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn