C Math Function


All the C program inbuilt functions which are declared in math.h header file. ‘Math.h’ header files support for all the mathematical related functions in C programming language.


floor() This function gives the nearest integer which is less than or equal to the argument passed to this function.
round() This function gives the nearest integer value of the float/ double/ long double argument passed to this function.
ceil() This function gives the nearest integer value which is greater than or equal to the argument passed to this function.
sin() This function is used to calculate the sine value.
cos() The cos( ) function is used to calculate the cosine.
cosh() The cosh( ) function is used to calculate the hyperbolic cosine.
exp() This function is used to calculate an exponential “e” to the nth power.
tan() The tan( ) function is used to calculate the tangent.
tanh() The tanh( ) function is used to calculate the hyperbolic tangent.
sinh() The sinh( ) function is used to calculate the hyperbolic sine.
log() It is used to calculates the natural logarithm.
sqrt() It is used to find the square root of the argument passed to this function.
pow() The pow() function is used to find the power of the given number.
trunc() This function truncates the decimal value from the floating point value and returns an integer value.

Example:

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

void main(){       
    printf("\n%f",ceil(3.3));      
    printf("\n%f",floor(3.2));     
    printf("\n%f",sqrt(7));    
    printf("\n%f",pow(2,4));   
    printf("\n%f",trunc(3.9)); 
    printf("\n%f",tan(7));    
    printf("\n%f",tanh(2));   
    printf("\n%f",exp(3.1)); 
}



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.