Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int n, i = 1;
- scanf_s("%d", &n); //n - количество членов ряда
- double A, F1 = 1.0, F2, p_otn, p_abs, b = 1.0;
- printf("A=");
- scanf("%lf", &A);
- while (i < n)
- {
- b = -b * A*A / ((2 * i - 1) * 2 * i);
- F1 = F1 + b;
- i++;
- }
- F2 = cos(A);
- p_abs = fabs(F1 - F2);
- p_otn = p_abs / F2;
- printf(" n=%d\n", n);
- printf(" F1=%.16lf\n", F1);
- printf(" F2=%.16lf\n", F2);
- printf(" p_abs=%.16lf\n", p_abs);
- printf(" p_otn=%.16lf\n", p_otn);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement