改错 数字(国外英文资料).docVIP

  • 14
  • 0
  • 约1.99万字
  • 约 31页
  • 2017-07-05 发布于河南
  • 举报
改错 数字(国外英文资料)

改错 数字 Error correction I. numerical questions 1 according to the integer parameter m, the value of the following formula is calculated. Y=1+1/ (2*2), +1/ (3*3), +1/ (4*4) +... +1/ (m*m) value. For example, if m=5, the output should be: 1.463611. Double fun (int m) {double y=1.0; int i; For (i=2; i=m; i++); y+=1.0/ (i*i); return (y);} 2 according to the parameter m, calculate the values of the following formulas. T=1-1/21/3-1/4... + (-1) (m+1) /m, for example, if you enter 5, you should output 0.783333. Double fun (int m) {double, t=1.0, j=1.0; int i; For (i=2; i=m; i++) {j=-1*j; t+=j/i;} Return T;} 3 according to the integer parameter m, calculate the value of the following formula. Y=1/ (100 x 100) +1/ (200 x 200) +1/ (300 * 300) +... +1/ (m * m). For example, if m=2000, 0.000160 should be output. Double fun (int m) {double, y=0, D; int i; For (i=100; i=m; i+=100) {d= (double) i* (double) I; y+=1.0/d;} Return (y)} 4 calculate the value of PI according to the following formula. For example, when you enter 0.0005 for EPS, you should output Pi=3.140578. PI /2=1+1/3+1/3*2/5+1/3*2/5*3/7+... Double fun (double EPS) {double, s, t; int, n=1; s=0.0; t=1.0; While (t=eps) {s+=t; t=t*n/ (2*n+1); N++;}return (s*2);} 5 according to the parameter m, calculate the values of the following formulas. T=1+1/2+1/3+1/4+... +1/m. For example, if you enter 5, you should output 2.283333. Double fun (int m) {double t=1.0; int i; For (i=2; i=m; i++) t+=1.0/i; Return T;} 6 according to the integer parameter m, calculate the value of the following formula. Y=1+1/ Reagan (2) +1/ (3) + reagan...... 1/ Reagan (n) for example, if the m value is: 5, should be output: 3.231671 #include, math.h, double, fun (int, m) {int I; double, t, y=0; For (i=1; i=m; i++) {t=1/sqrt (I); Y=y+t;}return y;} 7 calculate the value of the following formula based on the value of the integer parameter M. T=1-1/ (2 x 2) -1/ (3 * 3) -... -1/ (m * m), such as m=5, should output 0.536389 Double fun (int m) {double y=1.0; int

文档评论(0)

1亿VIP精品文档

相关文档