Header file:
math.h
Synopsis:
double acos(double x);
Description:
Returns arc cos of x.
acos 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 = acos(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 = acos(radian) * (180 / 3.14);
printf("Degree: %lf\n", deg);
return 0;
}
Output:
jp@jp-VirtualBox:~/cpgms/math$ gcc acos.c -lm
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:1
Degree: 0.000000
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:1
Degree: 0.000000
No comments:
Post a Comment