C语言编程,分别用while语句、do-while语句、for语句编写程序,计算e≈1+1/1!+

日期:2017-08-04 09:48:01 人气:1

C语言编程,分别用while语句、do-while语句、for语句编写程序,计算e≈1+1/1!+

#include double exp1(int n) { double i,m = 1,ee = 1; for(i = 1; i < n; ++i) { m *= i; ee += 1.0/m; } return ee;}double exp2(int n) { double i = 1,m = 1,ee = 1; while(i < n) { m *= i; ee += 1.0/m; ++i; } return ee;}double exp3(int n) {
    A+
热门评论