TheBulgarianWolf

Factorial Division

Oct 31st, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.Write("Enter your first number: ");
  11.             int first = int.Parse(Console.ReadLine());
  12.             Console.Write("Enter your second number: ");
  13.             int second = int.Parse(Console.ReadLine());
  14.             Console.WriteLine(FactorialDivision(first,second));
  15.  
  16.         }
  17.  
  18.         static int FactorialDivision(int int1,int int2)
  19.         {
  20.             int sum1 = 1;
  21.             for(int i = 1; i <= int1; i++)
  22.             {
  23.                 sum1 *= i;
  24.             }
  25.             int sum2 = 1;
  26.             for(int k = 1; k <= int2; k++)
  27.             {
  28.                 sum2 *= k;
  29.             }
  30.  
  31.             return sum1 / sum2;
  32.         }
  33.  
  34.        
  35.     }
  36. }
Add Comment
Please, Sign In to add comment