Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CalcFactorilAndPower
- {
- static void Main()
- {
- int N = int.Parse(Console.ReadLine());
- double power = int.Parse(Console.ReadLine());
- double sum = 1;
- double factorial = 1;
- //double result = 1; може и така да се направи
- double result = 0;
- for (int i = 1; i <= N; i++)
- {
- factorial = factorial * i;
- sum = sum * power;
- result += factorial / sum;
- }
- Console.WriteLine(Math.Round(result,5) + 1);
- //Console.WriteLine(Math.Round(result,5));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment