written 7.7 years ago by
teamques10
★ 64k
|
•
modified 5.1 years ago
|
Math.h functions:
1) abs 5) sqrt
2) cos 6) sin
3) floor 8) ceil
4) log 9) log10
5) pow 10) pow10
Sin (): Sin function returns sine of an angle (in radian).
Syntax: double sin (double);
Program code:
#include <stdio.h>
#include <math.h>
int main(){
double result, x = M_PI/6;
result = sin(x);
printf("Sin(%lf) = %.2lf\n", x, result);
return 0;
}
Output: Sin (0.523599) = 0.50
Cos (): Cos function returns cosine of an angle(in radian).
1 radian = 57.2958(approximately).
Syntax: double cos (double);
Program code:
#include <stdio.h>
#include <math.h>
int main(){
double result, x = 1.0471;
result = cos(x);
printf("Cos(%.4lf) = %.2lf\n", x, result);
return 0;
}
Output: Cos (1.0471) = 0.50