Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- Console.WriteLine("Введите X: ");
- double x = double.Parse(Console.ReadLine());
- Console.WriteLine("Введите K: ");
- double k = int.Parse(Console.ReadLine());
- Console.WriteLine("Введите EPS: ");
- double EPS = double.Parse(Console.ReadLine());
- if (Math.Abs(x) > 1)
- {
- Console.WriteLine("Неверное значение аргумента");
- Console.ReadKey();
- return;
- }
- double s = 0;
- double last = 0;
- for (int i = 1; ; i++)
- {
- double cur = f(2 * i) * Math.Pow(x, 2 * i + 1) / (Math.Pow(4, i) * Math.Pow(f(i), 2) * (2 * i + 1));
- if (Math.Abs(cur - last) < EPS) break;
- s += cur;
- last = cur;
- }
- Console.WriteLine("f1()");
- Console.WriteLine(last);
- Console.WriteLine("f2()");
- Console.WriteLine("f()");
- Console.WriteLine(Math.Acos(x));
- Console.ReadKey();
- }
- //факториал
- static int f(int x)
- {
- return (x == 0) ? 1 : x * f(x - 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement