fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double f(double a, double b, double x)
  5. {
  6. return a*sin(x)+b*cos(x);
  7. }
  8.  
  9. int main()
  10. {
  11. double a, b, i, j, dx;
  12. scanf("%lf %lf %lf %lf %lf", &a, &b, &i, &j, &dx);
  13.  
  14. double ans=0;
  15. for(double k = i; k < j; k += dx)
  16. {
  17. ans += f(a, b, k) * dx;
  18. }
  19.  
  20. printf("%.2f\n", ans);
  21. }
Success #stdin #stdout 0.01s 5284KB
stdin
0.0 1.0 0.0 3.14 0.01
stdout
0.00