ldcf.net
当前位置:首页 >> 用C语言编写程序求1%1/2+1/3%1/4+1/5%1/6+......+1... >>

用C语言编写程序求1%1/2+1/3%1/4+1/5%1/6+......+1...

#include int main(){ int i; float r=0; for(i = 1; i < 102; i ++) if(i%2==1) r+=1.0/i; else r-=1.0/i; printf("%f\n",r); return 0;}

#include int main() { int i; double sum,k=1; for(i=1,sum=0;i

#includeint main(){int i=1,n; float s=0; scanf("%d",&n); while(i

#include int main() { int sign=1; //符号变量 double deno=2.0,sum=1.0,term; //中间数和结果变量 while (deno

#include int main(void){ int i; float sum=1; for(i=2;i

#include #include void main(int argc, char *argv[]) {int i;float fCount;fCount = 0;for(i=1; i

#include int main(){ double f=1; int i; for(i=1;i

#include using namespace std;int main(){ int n; float sum = 0; do{ scanf("%d",&n); } while(n%2!=0 || n

您好,完整的程序如下,希望采纳哦~ #include main(){int i;double sum=0.0;i=2;do{sum+=1.0/i;i+=2;}while(i

int k=-1,s=0; for(int i=1;i

网站首页 | 网站地图
All rights reserved Powered by www.ldcf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com