# C - Exploring common math functions

## Introduction

The following table listed some common math functions.

Function
#include
What It Does
sqrt()
math.h
Calculates the square root of a floating-point value
pow()

math.h

Returns the result of a floating-point value raised to
a certain power
abs()

stdlib.h

Returns the absolute value (positive value) of an
integer
floor()

math.h

Rounds up a floating-point value to the next whole
number (nonfractional) value
ceil()

math.h

Rounds down a floating-point value to the next
whole number

## Demo

```#include <stdio.h>
#include <math.h>

int main() /*w  w w .  jav a2  s. co m*/
{
float result,value;

printf("Input a float value: ");
scanf("%f",&value);
result = sqrt(value);
printf("The square root of %.2f is %.2f\n", value,result);
result = pow(value,3);
printf("%.2f to the 3rd power is %.2f\n", value,result);
result = floor(value);
printf("The floor of %.2f is %.2f\n", value,result);
result = ceil(value);
printf("And the ceiling of %.2f is %.2f\n", value,result);
return(0);
}
```