为什么当我输入正确答案后,系统会弹出结果是否正确
#include<stdio.h>
int main()
{
int sum=0;
int i=1;
int flag=1;
while(i<=100)
{
i++;
sum+=i*flag;
flag*=-1;
}
printf("sum=%d\n",sum);
return 0;
}
#include<stdio.h>
int main()
{
int sum=0;
int i=1;
int flag=1;
while(i<=100)
{
i++;
sum+=i*flag;
flag*=-1;
}
printf("sum=%d\n",sum);
return 0;
}
2015-12-19
举报