e^1+e^2+e^3+.+e^n
问题描述:
e^1+e^2+e^3+.+e^n
答
for (int i = 1; i <= 50; i++)
{
double mNum = i;
for (int j = i - 1; j > 0; j--)
{
mNum *= j;
}
num += 1 / mNum;
}
Console.WriteLine(num);
第二个:
double num = 0;
int i = 1;
double mNum = 0;
do
{
mNum = i;
for (int j = i - 1; j > 0; j--)
{
mNum *= j;
}
num += 1 / mNum;
i++;
} while (1 / mNum > Math.Pow(10,-4));
Console.WriteLine(num);这个,看不懂诶!要自己计算的,不可以用机器·······