Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int fact(int i)
- {
- if (i > 1)
- return i * fact(i - 1);
- else
- return 1;
- }
- static int permutation(int m, int n)
- {
- if (n > m)
- {
- Console.WriteLine("Данные введены с ошибкой. Число гостей и число стульев поменяны местами");
- int t = n; n = m; m = t;
- }
- return fact(m) / (fact (n)*(fact (m-n)));
- Main()
- {
- Console.WriteLine(permutation(5, 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment