CSharp · Console
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("A expreção 1 + (1/1!) + (1/2!) + (1/3!) + ... + (1/n!)");
Console.WriteLine("Digite a quantidade de fatoação");
int s = int.Parse(Console.ReadLine());
double acum = 1;
for (int n = 1; n <= s; n++)
{
int fatorial = 1;
for (int i = n; i > 0; i--) fatorial *= i;
acum += (1 / (double)fatorial);
Console.WriteLine("A fatoração de " + n + " é: " + fatorial);
Console.WriteLine("1 ÷ pela fatoração de " + acum);
Console.WriteLine("######################################");
Console.WriteLine("");
}
Console.WriteLine("1 ÷ pela fatoração de " + acum);
}
}