Write a C function tat accepts a
real number x and prints out
corresponding value of
sin(1/x) using 4-decimal places Enter
value of x: 0.5
Value of sin(1/x) is 0.9093 Enter value
of x: 0
Answers
Answered by
3
Explanation:
#include <stdio.h>
#include <math.h>
int main()
{
double x, tval;
printf("Input value of x: \n");
scanf("%lf", & x);
if (x != 0.0)
{
tval = sin(1/x);
printf("Value of sin(1/x) is %0.4lf\n", tval);
}
else
{
printf("Value of x should not be zero.");
}
return 0;
}
Similar questions