Advertisement
Korobka887

Вариант 9. Таск 2

Apr 1st, 2023
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     double a, b, c, status = scanf("%lf%lf%lf", &a, &b, &c) == 3 && a < b && (b - a) / c == (int)((b - a) / c);
  6.    
  7.     for (double x = a; x <= b && status; x += c) {
  8.         printf("%lf | ", x);
  9.         if (x <= 0)
  10.             printf("%lf", sin(exp(-pow(x, 2)) + 0.25));
  11.         else if (x <= 1)
  12.             printf("%lf", pow(x, 3) + fabs(x - 2.5));
  13.         else
  14.             printf("%lf", 2.5 * exp(0.1 * x * sin(0.01 * x)));
  15.        
  16.         printf("\n");
  17.     }
  18.    
  19.     if (!status) printf("n/a");
  20.  
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement