petyaminkova91

Untitled

Oct 15th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _09_FactorialDivision
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int first = int.Parse(Console.ReadLine());
  10. int second = int.Parse(Console.ReadLine());
  11.  
  12. long factorielFirst = FindFactorial(first);
  13. long factorielSecond = FindFactorial(second);
  14.  
  15. double result = DivideFactorials(factorielFirst, factorielSecond);
  16.  
  17. Console.WriteLine($"{result:f2}");
  18. }
  19.  
  20. static long FindFactorial(long number)
  21. {
  22.  
  23. long factorial = 1;
  24.  
  25. for (int i = 1; i <= number; i++)
  26. {
  27. factorial *= i;
  28. }
  29.  
  30. return factorial;
  31. }
  32.  
  33. static double DivideFactorials(double first, double second)
  34. {
  35. double result = first / second;
  36.  
  37. return result;
  38. }
  39. }
  40. }
  41. 1
Advertisement
Add Comment
Please, Sign In to add comment