Home › C Tutorial › C math functions
C math functions
math.h helpers.
Include math.h: sqrt, pow, ceil, floor, fabs. Link with -lm on some systems.
Example code
#include <stdio.h>
#include <math.h>
int main() {
printf("%.1f %.0f %.0f %.1f\n", sqrt(49), pow(2, 5), ceil(4.1), fabs(-3.5));
return 0;
}