-2

I would like to approximate euler's number e for a school project. However, in most languages, you can only store around 30 decimal places. I would like to calculate around a hundred or more. is there a way I can do this? Here is my code if that helps:

decimal genauigkeit = 0;
Console.WriteLine("Geben Sie die genauikeit ein:(max 29)");
genauigkeit = Convert.ToInt32(Console.ReadLine());



for (decimal i = 0; i < genauigkeit; i++)
{
    decimal zwischenresultat = 1;
    for (decimal j = 1; j < i; j++)
    {
        zwischenresultat *= j;
    }
    resultat = resultat + 1 / zwischenresultat;
    Console.WriteLine(resultat);
}
resultat -= 1;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(resultat);
Console.ForegroundColor = ConsoleColor.White;

0 Answers0