一个问题的问题
include <stdio.h>
int main()
{
int sum = 0;
int i = 1;
int flag = 1;
while(i<=100)
{
if(flag==1)
{
i++;
sum+=i;
flag==0
}
else(flag==0)
{
i++;
sum=sum-i;
flag==1;
}
}
printf("%d\n",sum);
return 0;
}
各位大神,帮我看看错在哪里......
include <stdio.h>
int main()
{
int sum = 0;
int i = 1;
int flag = 1;
while(i<=100)
{
if(flag==1)
{
i++;
sum+=i;
flag==0
}
else(flag==0)
{
i++;
sum=sum-i;
flag==1;
}
}
printf("%d\n",sum);
return 0;
}
各位大神,帮我看看错在哪里......
2015-07-31
举报