Created
August 12, 2015 05:05
-
-
Save vdonchev/4e3a9e52a0533cd15ece to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Numerics; | |
namespace ConsoleApplication18 | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.WriteLine("Enter N="); | |
BigInteger n = BigInteger.Parse(Console.ReadLine()); | |
Console.WriteLine("Enter K="); | |
BigInteger k = BigInteger.Parse(Console.ReadLine()); | |
BigInteger sumK = 1; | |
BigInteger sumN = 1; | |
BigInteger sumM = 1; | |
if (1 < k && k < n && n < 100) | |
{ | |
for (int i = 1; i <= n; i++) | |
{ | |
sumN *= i; | |
} | |
for (int j = 1; j <= k; j++) | |
{ | |
sumK *= j; | |
} | |
for (int m = 1; m <= (n - k); m++) | |
{ | |
sumM *= m; | |
} | |
BigInteger sumF = sumN / (sumK * sumM); | |
Console.WriteLine("{0}", sumF); | |
} | |
else | |
{ | |
Console.WriteLine("Wrong input"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment