# Day 10 : Math.h header file detailed review and important functions in Math.h.

syntax: #include <math.h>

The math. h header defines different mathematical functions. All the functions are available in math.h library takes double(datatype) as an argument and returns double(datatype) as the result.

math. h provides Trigonometric Functions, Exponential and Logarithmic Functions, Rounding and Absolute Value Functions, etc.....

Math.h uses double datatype as input and result.

#### //**1. sqrt

In C programming, you can calculate the square root of a number using the sqrt() function, which is part of the math.h library.

#include <stdio.h>

#include <math.h>

int main() {

double number, result;

printf("Enter a number: ");

scanf("%lf", &number);

result = sqrt(number);

printf("Square root of %.2lf is %.2lf\n", number, result);

return 0;

}

#### //**2. power

In C programming, you can calculate the power of a number using the pow() function, which is part of the math.h library.

#include <stdio.h>

#include <math.h>

int main() {

double base, exponent, result;

printf("Enter the base: ");

scanf("%lf", &base);

printf("Enter the exponent: ");

scanf("%lf", &exponent);

result = pow(base, exponent);

printf("%.2lf raised to the power %.2lf is %.2lf\n", base, exponent, result);

return 0;

}

#### //**3. floor

In C programming, you can use the floor() function from the math.h library to round a floating-point number down to the nearest integer.

#include <stdio.h>

#include <math.h>

int main() {

double number;

printf("Enter a number: ");

scanf("%lf", &number);

double result = floor(number);

printf("The floor of %.2lf is %.2lf\n", number, result);

return 0;

}

#### //**4. ceil

In C programming, you can use the ceil() function from the math.h library to round a floating-point number up to the nearest integer.

#include <stdio.h>

#include <math.h>

int main() {

double number;

printf("Enter a number: ");

scanf("%lf", &number);

double result = ceil(number);

printf("The ceiling of %.2lf is %.2lf\n", number, result);

return 0;

}