Advertisement
dim4o

Loops_06_CalculateNK

Mar 26th, 2014
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. static void Main()
  2.         {
  3.             int n = int.Parse(Console.ReadLine());
  4.             int k = int.Parse(Console.ReadLine());
  5.             if (1 < k && k < n && n < 100)
  6.             {
  7.                 ulong resuult = 1;
  8.                 for (int index = k + 1; index <= n; index++)
  9.                 {
  10.                     resuult *= (ulong) index;
  11.                 }
  12.                 Console.WriteLine(resuult);
  13.             }
  14.             else
  15.             {
  16.                 Console.WriteLine("out of range");
  17.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement