Advertisement
Spocoman

08. Factorial Division

Jan 26th, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FactorialDivision
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = int.Parse(Console.ReadLine());
  11.  
  12.             Console.WriteLine($"{(Factorial(a) / Factorial(b)):f2}");
  13.         }
  14.  
  15.         static double Factorial(int n)
  16.         {
  17.             if (n == 0)
  18.             {
  19.                 return 1;
  20.             }
  21.  
  22.             return n * Factorial(n - 1);
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement