C – Math Functions

As the name suggests, the Math Functions in C language are used to perform mathematical tasks such as returning the sine, cosine, cube root, absolute value, etc. To work on Math Functions in C language, use the following header file:

Include it in your program file:

Here are the popular math functions in C language and what they will return after execution:

  • sqrt(a): square root of a
  • exp(a): e raised to the power of an i.e., Ea
  • cos(a): cosine of a
  • sin(a): sine of a
  • tan(a): tangent of an angle
  • acos(a): arccosine of a
  • asin(a): arcsine of a
  • atan(a): arctangent of a
  • ceil(a): rounds upwards to its nearest integer
  • floor(a): rounds a downwards to its nearest integer

Let us now see the above math functions one by one with examples:

sqrt() in C Language

The sqrt() function in C is used to get the square root of a number.

Let us now see an example of the sqrt() function:

Output

exp() in C Language

The exp() function in C is used to return e raised to the power of a.

Let us now see an example of the exp() function:

Output

cos() in C Language

The cos() function in C  returns the cosine of a.

Let us now see an example of the cos() function:

Output

sin() in C Language

The sin() function in C returns the sin of a.

Let us now see an example of the sin() function:

Output

tan() in C Language

The tan() function in C is used to return the tangent of a.

Let us now see an example of the tan() function:

Output

acos() in C Language

The acos() function in C returns the arc cosine of a in radians.

Let us now see an example of the acos() function:

Output

asin() in C Language

The asin() function in C  returns the arc sine of a in radians.

Let us now see an example of the asin() function:

Output

atan() in C Language

The atan() function in C  returns the arc tangent of a in radians.

Let us now see an example of the atan() function:

Output

cosh() in C Language

The cosh() function in C returns the hyperbolic cos of a.

Let us now see an example of the cosh() function:

Output

sinh() in C Language

The sinh() function in C  returns the hyperbolic sine of a.

Let us now see an example of the sinh() function:

Output

tanh() in C Language

The tanh() function in C  returns the hyperbolic tangent of a.

Let us now see an example of the tanh() function:

Output

If you liked the tutorial, spread the word, and share the link and our website Studyopedia with others:


For Videos, Join Our YouTube Channel: Join Now


Read More:

C Structures
C - Typecasting
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading