int main() {
long int i, k;
double n=1.0l;/*n!
double s = 1.0l;
for (i = 1; i < 50; i++) {
n=n*i;??
s += 1.0 / n;
}
printf(e = %lf\n, s);" />

亚洲男人天堂av,国产一区二区久久精品,国产精品一区二区久久精品,国产精品久久久久久一区二区三区,五月婷婷在线观看视频,亚洲狠狠色丁香婷婷综合

歡迎您訪問C語言 編寫程序求e的值 e=1+1/1!+1/2!+1/3!+......!

C語言 編寫程序求e的值 e=1+1/1!+1/2!+1/3!+......

更新時間:2021-12-23 01:35:56作者:admin2

#include <stdio.h>
int main() {
long int i, k;
double n=1.0l;/*n!
double s = 1.0l;
for (i = 1; i < 50; i++) {
n=n*i;??
s += 1.0 / n;
}
printf(e = %lf\n, s);
getchar();
return 0;
}
或:

public class Test{
public static void main(String args[]){
double sum=1,n=1;
double e=1;
for(n=1;n<=10;n++){
sum=sum*n;
e+=1/sum;}
System.out.println(e=+e);
}
}
得到的值為:2....
隨著n值越專大得到的e值越精屬確。



擴展資料:
C語言包含的各種控制語句僅有9種,關鍵字也只有32 個,程序的編寫要求不嚴格且以小寫字母為主,對許多不必要的部分進行了精簡。實際上,語句構成與硬件有關聯的較少,且C語言本身不提供與硬件相關的輸入輸出、文件管理等功能,如需此類功能,需要通過配合編譯系統所支持的各類庫進行編程,故c語言擁有非常簡潔的編譯系統。
參考資料來源:百度百科-c語言

為您推薦

加載中...
主站蜘蛛池模板: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |