Sephinroth

prac 4 ex 3

Sep 23rd, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _4._3
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("Введите k: ");
  13.             int k = int.Parse(Console.ReadLine());
  14.             double s = 0;
  15.             for (int i = 1; i <= k; i++)
  16.             {
  17.                 s += Math.Pow(-1, i+1) / Math.Pow(i,2);
  18.             }
  19.             Console.WriteLine("{0}", s);
  20.             Console.ReadKey();
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment