Korobka887

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

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