在Eclipse中,新建一个C/C++项目,试编程实现计算表达式1/2+2/3+3/4+…+99/100的值。}"/>
#include<stdio.h>#include<stdlib.h>main(){floati=0,sum=0;for(i=2;i<=100;i++){sum+=(i-1)/i;}printf("1/2+2/3+3/4+…+99/100=%f",sum);}
">
在Eclipse中,新建一个C/C++项目,试编程实现计算表达式1/2+2/3+3/4+…+99/100的值。}"/>
#include<stdio.h>#include<stdlib.h>main(){floati=0,sum=0;for(i=2;i<=100;i++){sum+=(i-1)/i;}printf("1/2+2/3+3/4+…+99/100=%f",sum);}