daily pastebin goal
22%
SHARE
TWEET

Factorial Division

a guest Feb 17th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Functions
  8. {
  9.     class Program
  10.     {
  11.         static private double Factorial(double n)
  12.         {
  13.             if (n == 1 || n == 0)
  14.             {
  15.                 return 1;
  16.             }
  17.             else
  18.                 return n * Factorial(n - 1);
  19.         }
  20.         private static void Main(string[] args)
  21.         {
  22.             double n = double.Parse(Console.ReadLine());
  23.             double k = double.Parse(Console.ReadLine());
  24.             double result = Factorial(n) / Factorial(k);
  25.             Console.WriteLine($"{result:F2}");
  26.         }
  27.  
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top