Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08FactorialDivision
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             decimal firstNumber = decimal.Parse(Console.ReadLine());
  10.             decimal secondNumber = decimal.Parse(Console.ReadLine());
  11.  
  12.             decimal division = Fact(firstNumber) / Fact(secondNumber);
  13.  
  14.             Console.WriteLine($"{division:F2}");
  15.         }
  16.  
  17.         static decimal Fact(decimal num)
  18.         {
  19.             if (num == 1)
  20.             {
  21.                 return 1;
  22.             }
  23.             else
  24.             {
  25.                 return num * Fact(num - 1);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement