11智能在线
新记
c语言 编写一个程序 1-1/2+1/3-1/4+1/5……-1/99+1/100用while语句!
如题所述
举报该文章
相关建议 2017-08-21
#include<stdio.h>
int main()
{int i=1;
float s=0;
while(i<101)
{if(i%2)s+=1.0/i;
else s-=1.0/i;
i++;
}
printf("%f\n",s);
return 0;
}
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/fs824vps4sq72sq484m.html
其他看法
无其他回答
相似回答
大家正在搜
相关问题
c语言 编写一个程序 1-1/2+1/3-1/4+1/5……...
C语言程序 1-1/2+1/3-1/4+...+1/99-1...
C语言程序"计算1-1/2+1/3-1/4+…+1/99-1...
用C语言编程:求1-1/2+1/3-1/4+1/5-1/6+...
1–1/2+1/3-1/4+……+1/99-1/100用C语...
C语言程序 1-1/2+1/3-1/4+...+1/99...
c语言 编写一个程序 1-1/2+1/3-1/4+1/5……...
用C语言编写(1-1/2+1/3-1/4+....+1/99...