Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- namespace Problem7
- {
- class CalculateFactorials2
- {
- static void Main(string[] args)
- {
- BigInteger firstNumber = BigInteger.Parse(Console.ReadLine());
- BigInteger secondNumber = BigInteger.Parse(Console.ReadLine());
- BigInteger n = firstNumber;
- BigInteger k = secondNumber;
- BigInteger kFact = 1;
- BigInteger nFact = 1;
- BigInteger nkFact = 1;
- for (BigInteger i = n; i > 1; i--)
- {
- nFact *= i;
- kFact *= k;
- if (k != 1)
- {
- k--;
- }
- if (i <= (firstNumber - secondNumber))
- {
- nkFact *= i;
- }
- }
- Console.WriteLine(nFact/(kFact*nkFact));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement