我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!
天气: 晴朗
心情: 高兴
/*P4Q10
* Name:Wang Chaoran
* Description:(Computing e) You can approximate e by using the following series:
*/
public class P4Q10
{
public static void main(String[] args)
{
//Compute the e
for(double i=10000;i<=100000;i+=10000)
{
double e = 1;
for(double j=i;j>=1;j--)
{
double factorial = 1;
for(int q=1;q<=j;q++)
{
factorial *= q;
}
e += 1/factorial;
}
System.out.println("If i = "+i+" e = "+e);
}
}
}
导入论坛查看(75)回复(0)引用(0)好评(0) 差评(0)
加入收藏
编辑
审核
TAG:
computing