ATAN2 Function in C

The C ATAN2 is a Math Library Function used to calculate the Trigonometric Arc Tangent of y/x. Or you can say it returns the angle in radius from the X-Axis to the specified point (y, x). The syntax of the atan2 is

double atan2(double y, double x);

ATAN2 Function in C Programming Example

The atan2 function in the math library helps you to find the trigonometric Arc Tangent of multiple parameters. This program asks the user for two values and then finds the arctangent value of those two parameters.

TIP: Please refer to the TAN and ATAN articles to see the program to calculate the Tangent and Arc Tangent values of the specified Programming expression.

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

int main()
{
  double atan2Value, X, Y;
  printf("\n Please Enter the Values for Y and X to calculate Arc Tangent of Y/X : \n ");
  scanf("%lf %lf", &Y, &X);
  
  atan2Value = atan2(Y, X);
  
  printf("\n The Arc Tangent value of %lf and %lf = %f ", Y, X, atan2Value);
  
  return 0;
}
ATAN2 Function in C Programming Example 1