I have to write a program that will evaluate the equation 2 ^ − √3+ x/2
, where 1 <= x <= 180
[No checking needed].
Here there are problem's Image
Those are some sample output:
Input:
30
Output:
1.810066
Input
120
Output
0.778151
Input
180
Output
3.954243
This is what I've tried so far, but it does not match the output wanted
#include <stdio.h>
#include <math.h>
int main() {
double x;
double result;
scanf("%lf", &x);
result = 2 * pow(cos(x),2) - sqrt(3) * sin(x) + sin(x / 2);
printf("%.8lf\n", result);
return 0;
}