Advertisement
Qellex

Untitled

Oct 15th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include "stdio.h" // подключение ввода, вывода
  2. #include "locale.h" // подключение русского языка
  3. #include "math.h" // подключение математики
  4.  
  5.  
  6.  
  7. void main() {
  8.  
  9. setlocale(LC_ALL, "rus"); // подключение русского языка
  10.  
  11. double x, eps, fx, n = 0, Sn = 1, s = 0;
  12.  
  13. do{
  14. printf("Введите x от -1 до 1 и eps: \n");
  15. scanf_s("%lf%lf", &x, &eps);
  16. } while (fabs(x) > 1);
  17.  
  18. fx = pow(x, 2) / sqrt(1 - pow(x, 2)) - pow(x, 2);
  19.  
  20. while (fabs(fx - s)) {
  21. n++;
  22. Sn *= ((2 * n - 1) / (2 * n)) * pow(x, 2);
  23. s += Sn;
  24. }
  25.  
  26.  
  27. printf("fx = %lf\ns = %lf\nn = %lf ", fx, s, n);
  28.  
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement