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