Iterate over the values of from to with a step of . For each value of , print a pair of numbers: and 3 \cdot sin(x).
Algorithm implementation
The function f returns the value 3 \cdot sin(x).
double f(double x)
{
return 3 * sin(x);
}The main part of the program. Read the input data.
scanf("%lf %lf %lf", &a, &b, &h);Iterate over the values of from to with a step of . For each value of , we print a pair of numbers: and .
for (x = a; x <= b; x += h)
printf("%.3lf %.3lf\n", x, f(x));