Back to: C
There are a number of math functions that are available, allowing you to perform mathematical operations on numbers. To use these functions, you need to include the math.h header file:
#include <math.h>
square root
To find the square root of a number, use the sqrt() function:
printf("%f", sqrt(10));
rounding up
To round a number up to the nearest integer, use the ceil() function:
printf("%f", ceil(1.3));
rounding down
To round a number down to the nearest integer, use the floor() function:
printf("%f", floor(1.3));
power
To find the power of a number, use the pow() function:
printf("%f", dow(3, 9));
abs(x)
To find the absolute value of a specified number, where absolute represents a positive number:
int abs(int x);
acos(x)
The acos function takes a single argument and returns the arc cosine in radians:
double acos(double x);