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 Factorial_division
- {
- class Program
- {
- static void Main(string[] args)
- {
- int first = int.Parse(Console.ReadLine());
- int second = int.Parse(Console.ReadLine());
- FirstFactorial(first);
- SecondFactorial(second);
- Console.WriteLine($"{FinalResult(first, second):F2}");
- }
- static int FirstFactorial(int a)
- {
- int current = 1;
- int actual = 0;
- if (a >= 1)
- {
- for (int num = a; num >= 1; num--)
- {
- actual = num;
- current = actual * current;
- }
- }
- return current;
- }
- static int SecondFactorial(int b)
- {
- int digit = 1;
- int value = 0;
- if (b >= 1)
- {
- for (int num = b; num >= 1; num--)
- {
- value = num;
- digit = value * digit;
- }
- }
- return digit;
- }
- static double FinalResult(int a, int b)
- {
- double calculation = FirstFactorial(a) / SecondFactorial(b);
- return calculation;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement