Advertisement
Guest User

Untitled

a guest
Apr 20th, 2021
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace PrintDeckOfCards
  6. {
  7. class Program
  8. {
  9. static void Main()
  10. {
  11. int N = int.Parse(Console.ReadLine());
  12. int x = int.Parse(Console.ReadLine());
  13. double sum = 1;
  14. int factoriel = 1;
  15.  
  16. for (int i = 1; i <= N; i++)
  17. {
  18. factoriel *= i;
  19. sum += factoriel / Math.Pow(x, i);
  20. }
  21. Console.WriteLine($"{sum:F5}");
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement