Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
1 #include<stdio.h> 2 void main() 3 { 4 int n=0; 5 double e=1,t=1;//t记录阶乘 6 char str[65]; 7 printf("n e\n"); 8 printf("- -----------\n"); 9 while(n<=9) 10 { 11 printf("%d ",n); 12 switch(n) 13 { 14 case 0: 15 case 1: 16 printf("%.0lf\n",e); 17 break; 18 case 2: 19 printf("%.1lf\n",e); 20 break; 21 default: 22 printf("%.9lf\n",e); 23 break; 24 } 25 t*=++n; 26 e += 1.0/t; 27 } 28 }
本文转自ZH奶酪博客园博客,原文链接:http://www.cnblogs.com/CheeseZH/archive/2013/03/12/2955186.html,如需转载请自行联系原作者