Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 = FirstNumberFact(firstNumber) / SecondNumberFact(secondNumber);
  13.  
  14.             Console.WriteLine($"{division:F2}");
  15.         }
  16.  
  17.         static decimal FirstNumberFact(decimal firstNum)
  18.         {
  19.             if (firstNum == 1)
  20.             {
  21.                 return 1;
  22.             }
  23.             else
  24.             {
  25.                 return firstNum * FirstNumberFact(firstNum - 1);
  26.             }
  27.         }
  28.  
  29.         static decimal SecondNumberFact(decimal secondNum)
  30.         {
  31.             if (secondNum == 1)
  32.             {
  33.                 return 1;
  34.             }
  35.             else
  36.             {
  37.                 return secondNum * SecondNumberFact(secondNum - 1);
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement