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]);

 

Suggested for you

Function in C language

User defined function in C language

String function in C language

Method in Java  Language

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

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

2 months ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

2 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

10 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

10 months ago