Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static double F_Rec(int n, int i, out double res)
  11.         {
  12.             if (n <= 0)
  13.                 return res = 0;
  14.             if (i != n)
  15.                 return res = Math.Sqrt(i + F_Rec(n, i + 1, out res));
  16.             else return  res = Math.Sqrt(n);
  17.            
  18.         }
  19.  
  20.         static void Main(string[] args)
  21.         {
  22.             int i = 1;
  23.             double res;
  24.             Console.Write("Введите N: ");
  25.             int n = int.Parse(Console.ReadLine());
  26.             Console.WriteLine(F_Rec(n, i, out res) == 0 ? "Функция не определена" : (n / F_Rec(n, i, out res)).ToString());
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement