求e的值:e=1/0!+1/1!+1/2!+1/3!+1/4!+…+1/n!
问题描述:
求e的值:e=1/0!+1/1!+1/2!+1/3!+1/4!+…+1/n!
用while循环,计算前n项
用do…while循环,要求直至最后一项的值小于10-6
答
#include <stdio.h>int main(){double e=1;int index = 1;;int mul = 1;double cur;do{mul*=index;index ++;cur = 1.0/mul;e +=&nb...两个问题 要分开两个程序 去求# include