w3resource

C atan() function

C atan() function - Calculate Arctangent

Syntax:

double atan(double x)

The atan() function is used to calculate the arctangent of x.

Parameters:

Name Description Required /Optional
x This is the floating point value. Required

Return value from atan()

  • The atan() function returns a value in the range -π/2 to π/2 radians.

Example: atan() function

The following example shows the usage of atan() function.


#include <stdio.h>
#include <math.h>
int main(void)
{
    double a,c;
     c = 0.45;
     a = atan(c);
     
    printf("atan( %lf ) = %lf", c, a);
    c = 0;
    a = atan(c);
     
    printf("\natan( %lf ) = %lf", c, a);

    c = 1;
    a = atan(c);
     
    printf("\natan( %lf ) = %lf", c, a);
}

Output:

atan( 0.450000 ) = 0.422854
atan( 0.000000 ) = 0.000000
atan( 1.000000 ) = 0.785398

C Programming Code Editor:

Previous C Programming: C asin()
Next C Programming: C atan2()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/c-programming/math/c-atan.php