Arithmetic function in C programming language with example
In this tutorial, we will discuss the arithmetic function in C programming language with example.
In the c programming language, arithmetic pre-defined functions is used to perform arithmetic calculation or other mathematical operations.
stdlib.h and math.h header files support all the arithmetic functions in C language
1. abs() –
This arithmetic function in C language returns absolute value of a given integer.
Syntex
int abs(int value);
2. floor() –
This arithmetic function in C language returns the nearest integer value which is less than or equal to the given floating point argument value.
Syntex
double floor(double value);
This arithmetic function in C language returns the nearest integer value which is greater than or equal to the given floating point argument value.
Syntex
double ceil(double value);
When the above code is executed, the following output is displayed
4. round() –
This arithmetic function in C language returns the nearest integer value of the given float, double, long double argument value
Syntex
double round(double value);
This arithmetic function in c language returns the nearest float sine value of the given argument value
Syntex
double sin(double value);
This arithmetic function in c language returns the nearest float cosine value of the given argument value
Syntex
double cos(double value);
When the above code is executed, the following output is displayed
cosine value of 1 is : 0.540302
This arithmetic function in c language returns the nearest float tangent value of the given argument value
Syntex
tan(float value);
When the above code is executed, the following output is displayed
The tangent value of 1 is : 1.557408
This arithmetic function in C language returns log of x to the base of e
Syntex
double log(double value);
When the above code is executed, the following output is displayed
The log value of 100 is : 4.605170
This arithmetic function in C language returns log of x to the base of 10
Syntex
double log10(double value);
When the above code is executed, the following output is displayed
log value of 10 is: 1.000000
This arithmetic function in C language returns the result of e raised to the power of x
Syntex
exp(double value);
When the above code is executed, The following output is displayed.
This arithmetic function in C language returns x raised of to the power of y.
Syntex
pow(double value1,double value 2);
When the above code is executed, the following output is displayed
This arithmetic function in C language returns the Square root of x
Syntex
sqrt(double value);
This arithmetic function in c language returns the hyperbolic sine of x
Syntex
sinh(double value);
sinh value of 0.5 :0.521095
sinh value of 0.7 :0.758584
This arithmetic function in C language returns the hyperbolic cosine of x
Syntex
cosh(double value);
This arithmetic function in C language returns the hyperbolic tangent of x
Syntex
cosh(double value);
When the above code is executed, the following output is displayed.
tanh value of 0.5 :0.462117
tanh value of 0.7 :0.604360
Suggested for you
String function in Python language
Arithmetic function in Python language