Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FactorialDivision
- {
- class Program
- {
- static void Main()
- {
- double firstNumber = double.Parse(Console.ReadLine());
- double secondNumber = double.Parse(Console.ReadLine());
- double result = CalculateFirstNumberFactorial(firstNumber) / CalculateSecondNumberFactorial(secondNumber);
- Console.WriteLine($"{result:f2}");
- }
- public static double CalculateFirstNumberFactorial(double firstNumber)
- {
- double factorial = 1;
- for (double i = firstNumber; i >= 1; i--)
- {
- factorial *= i;
- }
- if(firstNumber == 0)
- {
- factorial = 1;
- }
- return factorial;
- }
- public static double CalculateSecondNumberFactorial(double secondNumber)
- {
- double factorial = 1;
- for (double j = secondNumber; j >= 1; j--)
- {
- factorial *= j;
- }
- if(secondNumber == 0)
- {
- factorial = 1;
- }
- return factorial;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement