Kosty_Fomin

Untitled

Oct 27th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. public class Test
  5. {
  6.     public static void Main ()
  7.     {
  8.  
  9.          
  10.         double x, n = 1, s = 1, i = 1, c = 0.0001;
  11.  
  12.         do {
  13.             Console.WriteLine ("Input x: ");
  14.  
  15.         } while(!double.TryParse (Console.ReadLine (), out x));
  16.  
  17.  
  18.  
  19.         while (n > c) {
  20.             s += n;
  21.  
  22.  
  23.             n = 1 / ((double)Math.Pow (x, 2 * i));
  24.             Console.WriteLine ((1 / (double)Math.Pow (x, 2 * i)) + "\t" + "i = " + i + " ");
  25.  
  26.             Console.Write (s + "\n");
  27.        
  28.             i++;
  29.  
  30.  
  31.  
  32.         }
  33.         //Console.WriteLine (s);
  34.         Console.ReadLine ();
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment