Advertisement
Guest User

Cc

a guest
Sep 18th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define A -3.0
  4. #define B 3.0
  5. double F(double x)
  6. {
  7.  return sin(x) + x*x;
  8. }
  9. int main( )
  10. {
  11.  double x, y, h;
  12.  int count, n;
  13.  count = 0;
  14.  printf("n = "); scanf("%d", &n); /* количество строк в таблице */
  15.  h = (B - A) / (n - 1);
  16.  for(x = A; x <= B; x += h)
  17.  {
  18.  y = F(x);
  19.  printf("%10.4f %10.4f\n", x, y);
  20.  if (x >= -1 && x <= 5 && y >= -2 && y <= 3)
  21.  count++;
  22.  }
  23.  printf("count = %d\n", count);
  24.  return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement