Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 sum = 0.5 * Math.PI - x;
- double tmp = x, eps;
- eps = EPS;
- for (int i = 1; ; i++)
- {
- tmp *= (x * x * (2 * i - 1)) / (2 * i);
- if (sum < eps) break;
- }
- Console.WriteLine("f1()");
- Console.WriteLine(sum);
- sum = 0.5 * Math.PI - x;
- double tmp2 = x, eps2;
- Console.WriteLine("f2()");
- for (int i = 1; i < k; i++)
- {
- tmp2 *= (x * x * (2 * i - 1)) / (2 * i);
- eps2 = tmp2 / (2 * i + 1);
- sum -= eps2;
- }
- Console.WriteLine(sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement