Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class FactorialDivision
- {
- static void Main()
- {
- Console.WriteLine("Enter two numbers:");
- Console.Write("N!");
- int n = int.Parse(Console.ReadLine());
- Console.Write("K!");
- int k = int.Parse(Console.ReadLine());
- decimal factorialN = 1;
- decimal factorialK = 1;
- if ((n < 1) || (k < 1) || (n < k))
- {
- Console.WriteLine("You made wrong input!");
- }
- else
- {
- do
- {
- factorialN *= n;
- n--;
- }
- while (n > 0);
- do
- {
- factorialK *= k;
- k--;
- }
- while (k > 0);
- Console.WriteLine("N! / K! = {0}", factorialN / factorialK);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement