atan() function of math.h in C

In this article, we are going to learn about the use atan() function of math.h header file in C language and use it with the help of an example.
Submitted by Manu Jemini, on April 01, 2018

This function provides the functionality to calculate the arc tan of a value. The value should be less than equal to π/2 and greater than equal to -π/2.

This function takes a single parameter as the number whose arc tan value needs to be calculated and return the value which is the result of the calculation.

Example:

    X = 0.7
    The function will return 0.610726

This function is a part of math.h library and it must be included in the program.

math.h - atan() function Example in C

#include <stdio.h>
#include <math.h>

int main()
{
	// Defining variables
	double a,b;

	// Assigning value for getting atan value
	a = 0.7;

	// Calculating the arc tangent of a
	b = atan(a);

	// Displaying the result for user
	printf("The calculated value is: %lf \n\n", b);

	return 0;
}

Output

math.h - atan()  in c language



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.