Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
Extract all possible substrings from a string
Umbraco
Conversioni double
w
Subdomain regex
Shorten SMS Text
Vignere Cipher
Enumeration
Contraseña final
Hi
Please log in to post a comment.