C Math Functions
Math Functions
There is also a list of math functions available, that allows you to perform mathematical tasks on numbers.
To use them, you must include the math.h
header file in your program:
#include <math.h>
Square Root
To find the square root of a number, use the sqrt()
function:
Round a Number
The ceil()
function rounds a number upwards to its nearest integer, and the floor()
method rounds a number downwards to its nearest integer, and returns the result:
Power
The pow()
function returns the value of x to the power of
y (xy):
Complete Math Reference
For a complete reference of math functions, go to our C <math.h> Library Reference.