Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class DividesTwoFactorials
- {
- static void Main()
- {
- Console.Write("write N: ");
- int N = int.Parse(Console.ReadLine());
- Console.Write("write K: ");
- int K = int.Parse(Console.ReadLine());
- Factorial(N, K);
- Console.WriteLine("N! / K! = {0}", Factorial(N, K));
- }
- static long Factorial(int N, int K)
- {
- long factorial = 1;
- for (int i = K + 1; i <= N; i++)
- {
- factorial = factorial * i;
- }
- return factorial;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment