Advertisement
Sephinroth

prac 4 ex 4

Sep 30th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _4._4
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("Введите точность e: ");
  13.             double e = double.Parse(Console.ReadLine());
  14.             double a = 1, s = 0;
  15.             int i = 2;
  16.             while (Math.Abs(a) >= e)
  17.             {
  18.                 s += a;
  19.                 a /= Math.Pow(i, 2) - 1;
  20.                 i++;
  21.             }
  22.             Console.Write("{0:f6}", s);
  23.             Console.ReadKey();
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement