Advertisement
OIQ

Untitled

OIQ
Oct 20th, 2020
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         double x = double.Parse(Console.ReadLine());
  9.         double a1 = x * x * x * x / 2 / 3 / 4;
  10.         double s0 = double.MinValue;
  11.         double s1 = a1;
  12.         for (int i = 1; Math.Abs(s1 - s0) > double.Epsilon; i++) {
  13.             s0 = s1;
  14.             a1 = a1 * -(x * x * x) / (3 * (i - 1) + 5) / (3 * (i - 1) + 6) / (3 * (i - 1) + 7);
  15.             s1 = s0 + a1;
  16.         }
  17.         Console.WriteLine(s1);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement