Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int x = int.Parse(Console.ReadLine());
- float sum = 1;
- float factorial = 1;
- int power = x;
- for (int count = 1; count <= n; count++)
- {
- factorial *= count;
- sum += factorial / x;
- Console.WriteLine(sum);
- x *= power;
- }
- Console.WriteLine("{0 :F5}", sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement