Advertisement
Guest User

122 g

a guest
Jan 19th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _122_zadacha_g_
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double x, eps;
  14.             do
  15.             {
  16.                 Console.Write("Enter x: ");
  17.                 x = double.Parse(Console.ReadLine());
  18.             } while (Math.Abs(x) > 1);
  19.  
  20.             do
  21.             {
  22.                 Console.Write("Enter eps: ");
  23.                 eps = double.Parse(Console.ReadLine());
  24.             } while (eps <= 0 || eps >= 0.01);
  25.  
  26.  
  27.             double y, a, i;
  28.             y = x;
  29.             a = x;
  30.             i = 1;
  31.             double u = (2 * i) + 1;
  32.  
  33.             do
  34.             {
  35.                 a = Math.Pow(-1, i) * Math.Pow(x, ((2 * i) + 1));
  36.                 u = (2 * i) + 1;
  37.                 y += a / u;
  38.                 i++;
  39.             } while (Math.Abs(a / i) >= eps);
  40.  
  41.             Console.WriteLine("y = {0}; ArcTg({1}) = {2}", y, x, Math.Atan(x));
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement