Advertisement
svetoslavbozov

[C#-1.6.6] DivideFactorials

Dec 30th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. /*Напишете програма, която пресмята N!/K! за дадени N и K (1<K<N).
  2. */
  3. using System;
  4.  
  5. class DivideFactorials
  6. {
  7.     static void Main()
  8.     {
  9.         int n = int.Parse(Console.ReadLine());
  10.         int k = int.Parse(Console.ReadLine());
  11.         int result = 1;
  12.  
  13.         if ((k > 1) && (k < n))
  14.         {
  15.            for (int i = k + 1; i <= n; i++)
  16.             {
  17.             result *= i;
  18.             }
  19.         Console.WriteLine(result);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement