为什么算到的结果是16,怎么算的。,
int i=0,s=0;do
{
if(i%2){i++;continue;}
i++;
s+=i;
}
while(i<7);
printf("%d\n",s);
具体步骤:
i=0: i=1 s=1
i=1: i=2 s=1
i=2: i=3 s=4
i=3: i=4 s=4
i=4: i=5 s=9
i=5: i=6 s=9
i=6: i=7 s=16
i=7:不满足循环条件,退出
雪是梅之香 发表于 2015-1-16 13:36
具体步骤:
i=0: i=1 s=1
i=1: i=2 s=1
O(∩_∩)O谢谢
页:
[1]