Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _122_zadacha_g_
- {
- class Program
- {
- static void Main(string[] args)
- {
- double x, eps;
- do
- {
- Console.Write("Enter x: ");
- x = double.Parse(Console.ReadLine());
- } while (Math.Abs(x) > 1);
- do
- {
- Console.Write("Enter eps: ");
- eps = double.Parse(Console.ReadLine());
- } while (eps <= 0 || eps >= 0.01);
- double y, a, i;
- y = x;
- a = x;
- i = 1;
- double u = (2 * i) + 1;
- do
- {
- a = Math.Pow(-1, i) * Math.Pow(x, ((2 * i) + 1));
- u = (2 * i) + 1;
- y += a / u;
- i++;
- } while (Math.Abs(a / i) >= eps);
- Console.WriteLine("y = {0}; ArcTg({1}) = {2}", y, x, Math.Atan(x));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement