Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
n!/x*x
using System; namespace Rextester { public class Program { public static void Main(string[] args) { int n = 3; int x = 2; decimal result = 1.00000m; for (int i = 1; i <= n; i++) { result = (result + (GetFactorial(i)/ (decimal) Math.Pow(x, i))); } Console.WriteLine(Math.Round(result,5)); } public static decimal GetFactorial(int n) { decimal result = 1; for (int i = n; i > 1; i--) { result = result * i; } return result; } } }
run
|
edit
|
history
|
help
0
mine
Work Days
Project Euler Problem 6
Random number generator with IF
database interior 0.2
*271*271#
Roman Numbers, Sorting through IComparer
PERSHENDETJE
rzError
Palindrome 2