Advertisement
nevenailievaa

Задача 4: (Стр. 74, Зад 122 - И):

Oct 23rd, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. namespace Logaritm
  2. {
  3.     using System;
  4.  
  5.     class Task122I
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double x = double.Parse(Console.ReadLine());
  10.             double epsilon = double.Parse(Console.ReadLine());
  11.  
  12.             double etalon = Math.Log(x);
  13.             int n = 1;
  14.             double sum = 0;
  15.  
  16.             while (Math.Abs(etalon - sum) > epsilon)
  17.             {
  18.                 sum += 2 * (1.0 / (2 * n - 1)) * Math.Pow((x - 1.0) / (x + 1.0), 2 * n - 1);
  19.                 n++;
  20.             }
  21.  
  22.             Console.WriteLine(sum);
  23.         }    
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement