Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Lab_6
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double x = 0, e = 0.0001, E1 = 0, E2 = 1, S = -1, i = 0;
  13.             x = Convert.ToDouble(Console.ReadLine());
  14.             while (Math.Abs(E2 - E1) >= e)
  15.             {
  16.                 i++;
  17.                 E1 = E2;
  18.                 E2 *= (- x * x) / (i * (i + 1));
  19.                 S += E2;
  20.             }
  21.             Console.WriteLine("S = " + S);
  22.             Console.Read();
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement