TzvetanIG

Calculate N! / K!

Apr 13th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class CalculateFactorialNDividedFactorialK
  5. {
  6.     static void Main()
  7.     {
  8.         int n = int.Parse(Console.ReadLine()); ;
  9.         int k = int.Parse(Console.ReadLine()); ;
  10.         long product = 1;
  11.  
  12.         for (int i = (k+1); i <= n; i++)
  13.         {
  14.             product *= i;
  15.         }
  16.  
  17.         Console.WriteLine(product);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment