Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int const N = 1000;
- int main()
- {
- int a = 4, b = 6, f = 0, A[N + 1], I1 = 0, I2 = 0, ch = 0, nh = 0;
- float h, x = 0;
- h = 0.2;
- for (int i = 0; i <= N; i ++ )
- {
- x += h;
- f = (2.5 * pow(x, 2) - 0.1) / (tan(x) + sin(x));
- A[i] = f;
- }
- for (int i = 1; i <= N - 1; i++)
- I1 += A[i];
- I1 += A[0] / 2 + A[N] / 2;
- I1 *= h;
- printf("%d\n", I1);
- for (int i = 0; i <= N; i++)
- {
- if (i % 2 == 0)
- ch += A[i];
- else
- nh += A[i];
- }
- I2 = h / 3 * (A[0] + A[N] + 4 * nh + 2 * ch);
- printf("%d", I2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement