Advertisement
MyOnAsSalat

Untitled

Nov 19th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. Console.WriteLine("Введите X: ");
  9. double x = double.Parse(Console.ReadLine());
  10. Console.WriteLine("Введите K: ");
  11. double k = int.Parse(Console.ReadLine());
  12. Console.WriteLine("Введите EPS: ");
  13. double EPS = double.Parse(Console.ReadLine());
  14. if (Math.Abs(x) > 1)
  15. {
  16. Console.WriteLine("Неверное значение аргумента");
  17. Console.ReadKey();
  18. return;
  19. }
  20. double s = 0;
  21. double last = 0;
  22. for (int i = 1; ; i++)
  23. {
  24. double cur = f(2 * i) * Math.Pow(x, 2 * i + 1) / (Math.Pow(4, i) * Math.Pow(f(i), 2) * (2 * i + 1));
  25. if (Math.Abs(cur - last) < EPS) break;
  26. s += cur;
  27. last = cur;
  28. }
  29. Console.WriteLine("f1()");
  30. Console.WriteLine(last);
  31.  
  32. Console.WriteLine("f2()");
  33.  
  34.  
  35. Console.WriteLine("f()");
  36. Console.WriteLine(Math.Acos(x));
  37. Console.ReadKey();
  38.  
  39. }
  40. //факториал
  41. static int f(int x)
  42. {
  43. return (x == 0) ? 1 : x * f(x - 1);
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement