Sephinroth

prac 4 ex 2

Sep 23rd, 2019
143
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _4._2
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("Введите n: ");
  13.             int n = int.Parse(Console.ReadLine());
  14.             double s = 0;
  15.             for (int i = 1; i <= n; i++)
  16.             {
  17.                 s += Math.Pow(i, (-1));
  18.             }
  19.             Console.WriteLine("{0}", s);
  20.             Console.ReadKey();
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment