include include int main int x g printfenter an x value sc
#include <stdio.h>
#include <math.h>
int main()
{
int x, g;
printf(\"enter an x value\ \");
scanf(\"%d\",&x);
g = 2*x*sin(x)+cos(x)+(4*x+3)/(3*pow(x,2)+2*x+4);
printf(\"The answer is .2&d\ \",g);
return 0;
}
The question is: Calculate the values of the following function using a C function at x=3.5.
That is what I have and am unsure where i went wrong.
Solution
Program)
#include <stdio.h>
#include <math.h>
int main()
{
int x, g;
printf(\"enter an x value\ \");
scanf(\"%d\",&x);
g = 2*x*sin(x)+cos(x)+(4*x+3)/(3*pow(x,2)+2*x+4);
printf(\"The answer is %d\ \",g); // here in order to print integer value we shoud write %d
return 0;
}
Output:
enter an x value
3.5
the answer is 3
