Home > Backend Development > C#.Net Tutorial > Usage of sqrt function in C language

Usage of sqrt function in C language

angryTom
Release: 2020-02-06 13:29:48
Original
11729 people have browsed it

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template