Header file:
math.h
Synopsis:
double atan(double x);
Description:
Returns principal value of the arc tangent of x.
atan function in C example:
#include<stdio.h>
#include<math.h>
int main() {
/*
* radian to degree conversion
* degree = radian * 180 / PI;
*/
double deg, radian;
printf("Enter your input:");
scanf("%lf", &radian);
deg = atan(radian) * (180 / 3.14);
printf("Degree: %lf\n", deg);
return 0;
}
#include<math.h>
int main() {
/*
* radian to degree conversion
* degree = radian * 180 / PI;
*/
double deg, radian;
printf("Enter your input:");
scanf("%lf", &radian);
deg = atan(radian) * (180 / 3.14);
printf("Degree: %lf\n", deg);
return 0;
}
Output:
jp@jp-VirtualBox:~/cpgms/math$ gcc atan.c -lm
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:1
Degree: 45.022825
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:1
Degree: 45.022825
No comments:
Post a Comment