Categories: C LanguageLearn C++

Arithmetic function in C programming language

Arithmetic function in C programming language

In this tutorial, we will discuss the arithmetic function in C programming language

       The arithmetic function is used for the mathematical purpose in C Language
  • C programming language contains a lot of header files for various purposes.
  • One of the header file  #include<math.h>, is used to perform methamatical operations in a program called  math function or arithmatic function.
  • Some of the example of arithmatic functions for abs(), floor(), round(), ceil(), sqrt(), exp(), log(), sin(), cos(), tan(), pow() and trunc()are explaind below.
  • “math.h” and “stdlib.h” header files support all the arithmetic functions in C Language.

Arithmetic function in C

abs(): This function returns the absolute value of only an integer.The absolute value of a number is always positive. abs() maths function supports only integer value in C language. It does not support any datatype – float(fabs), double . This function includes #include<stdlib.h> header file.

Syntex
int abs(int value);

floor(): This functions opposite of th ceil function. It returns the nearest integer value which is less than or equal to the passing argument of this function(rounds dawns the nearest integer). This function includes #include<math.h> header file

Syntex
double floor(double value);

ceil() : This function is oposite of the floor function. It returns nearest and smallest integer value that is greater than or equal(not less than) to the passing argument of this function. This function includs #include<math.h> header file

Syntex
double ceil(double value);

round() :This function returns the nearest integer value of the float or double or lond ,double passing the argument to the function.This function include #include<math.h> header file

Syntex
double round(double value);

sin() : This function is used to calculate sine value.This function includes #include<math.h> header file

Syntex
double sin(double value);

cos() : Thid function is used to calculate cosine value.This function includes #include<math.h> header file

Syntex
double cos(double value);

cosh() : Thid function is use to calculate hyperbolic cosine value.This function includes #include<math.h> header file

Syntex
double cosh(double value);

exp() : This function is use to  calculate the exponential “e” to the nth power.This function includes #include<math.h> header file

Syntex
double exp(double value);

tan() : This function is use tocalculate tangent.This function includes #include<math.h> header file

Syntex
double tan(double value);

tanh() : This function is used to perform  hyperbolic tangent. This function includes #include<math.h> header file

Syntex
double tanh(double value);

sinh() : This function is used to calculate tangent. This function includes #include<math.h> header file

Syntex
double sinh(double value);

log(): This function is used to calculate natural logarithum. This function include s#include<math.h> header file

Syntex
double log(double value);

log10() :  This function is used to calculate base 10 logarithum. This function includes #include<math.h> header file

Syntex
double log10(double value);

sqrt() : This function is used to find the sqaure root of the argument passed to this function. This function includs   #include<math.h> header file. This function includes #include<math.h> header file

Syntex
double sqrt(double value);

pow() : This is used to find the power of the given number. This function includes in #include<math.h> header file

Syntex
double pow(double value1, double value2);

trunc() : This function truncates the decimal value from floating point value and returns an integer value.. This function includes #include<math.h> header file

Syntex
trunc(number,[decimal_places]);

 

Suggested for you

Function in C language

String function in C language

String function in C language with example

Math function in Python

String function in Python

 

 

Karmehavannan

Recent Posts

Multiply two numbers in Java using scanner| 5 different ways

Multiply two numbers in Java using scanner| 5 different ways In this article, we will…

3 months ago

5 different ways to Divide two numbers in Java using scanner

5 Different ways to Divide two numbers in Java using scanner In this article, we…

3 months ago

Learn 8 Ways to Subtract Two Numbers Using Methods in Java

Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…

4 months ago

10 ways to subtract two numbers in Java

10 ways to subtract two numbers in Java In this article, we will discuss the…

4 months ago

Java Code Examples – Multiply Two Numbers in 5 Easy Ways

Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…

4 months ago

How to Divide two numbers in Java| 5 different ways

How to Divide two numbers in Java| 5 different ways In this article, we will…

4 months ago

This website uses cookies.