c语言,计算1-1/2+1/3-1/4.+1/99-1/100我的程序哪错误了?#includemain(){float sum=0.0;int i,n,a=-1;printf("sum 1-1/2+1/3.");scanf("%d",&n);for(i=1;i

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 22:47:11
c语言,计算1-1/2+1/3-1/4.+1/99-1/100我的程序哪错误了?#includemain(){float sum=0.0;int i,n,a=-1;printf(
x͐N0_eh 7d$M`,|\qAq|(%0* & i-EI0os?i s]l2 &70m({/E2T߼ y^9.77WhQE*W )%XHP5J>V$"1A:7\)b$O< )̒TȚ8יE._G峫ߺ/G1`腃1y\s&zJջԡmg~6lj6Y<6Zy!3uyYM.HOn

c语言,计算1-1/2+1/3-1/4.+1/99-1/100我的程序哪错误了?#includemain(){float sum=0.0;int i,n,a=-1;printf("sum 1-1/2+1/3.");scanf("%d",&n);for(i=1;i
c语言,计算1-1/2+1/3-1/4.+1/99-1/100我的程序哪错误了?
#include
main()
{
float sum=0.0;
int i,n,a=-1;
printf("sum 1-1/2+1/3.");
scanf("%d",&n);
for(i=1;i

c语言,计算1-1/2+1/3-1/4.+1/99-1/100我的程序哪错误了?#includemain(){float sum=0.0;int i,n,a=-1;printf("sum 1-1/2+1/3.");scanf("%d",&n);for(i=1;i
a 是 整型,i也是整型,两个相除会做整除,只有1/1为1,其余都小余1而自动舍去小数部分,你把a定义成float就行了