function in C

Arithmetic function in C programming language

Arithmetic function in C programming language

We will learn about Arithmetic function in C programming language

In the C Programming language, the Arithmetic function is used for arithmetic calculations and manipulations.

The arithmetic function is used for the arithmetic 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 mathematical operations in a program called math function or arithmetic function
  • Some of the examples of arithmetic 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

abs(): This function returns the absolute value of an only integer.The absolute value of a number is always positive. abs() math function supports only integer value in C language and not any other datatype – float(fabs), double . #include<stdlib.h> header files are supported in this function.

Syntax

int abs(int x);

fabs(): This function returns the absolute value an only floating point value.The absolute value of a number is always positive only. fabs() maths function supported only floating point value in C language #include<math.h> header file supported of this function .

Syntax

double abs(double x);

labs(): This function returns the absolute value of an only long integer value. The absolute value of a number is always positive. labs() math function supports only long integer value in C language #include<math.h> header files are supported of this function .

Syntax

long int labs(long int x);

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

Syntax

double floor(double value);

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

Syntax

double ceil(double value);

round() :This function returns the nearest integer value of the float or double or long double and passes the argument to the function.This function includes #include<math.h> header file

Syntax

double round(double value);

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

Syntax

double sin(double value);

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

Syntax

double cos(double value);

cosh() : This function calculates hyperbolic cosine value.This function includes #include<math.h> header file Read more

Syntax

double cosh(double value)

tan() : This function calculates tangent value.This function includes #include<math.h> header file

Syntax

double tan(double value);

tanh() : This function  performs  hyperbolic tangent value. This function includs #include<math.h> header file

Syntax

double tanh(double value);

sinh() : This function calculates hyperbolic sine value. This function includes #include<math.h> header file

Syntax

double sinh(double value);

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

Syntax

double exp(double value);

log(): This function calculates natural logarithm. This function includes #include<math.h> header file

Syntax

double log(double value);

log10() :  This function is use to perform  calculate base 10 logarithm. This function include #include<math.h> header file

Syntax

double log10(double value);

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

Syntax

double sqrt(double value);

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

Syntax

double pow(double value1, double value2);

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

Syntax

trunc(number,[decimal_places]);

 

Similar Functions

Other C programming language functions that are  similar to the cosine function      

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

sqrt function in C language

pow function in C language

exp function in C language

log function in C language

log10 function in C language

trunc function in C language

 

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

fabs function

labs function

 

 

 

strcmp string function in C programming Language
abs Arithmetic function in C programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago

Java program to check odd or even using recursion

Java program to check odd or even using recursion In this tutorial, we discuss a…

2 months ago