• 2022-06-07
    和下面代码执行结束后,sum结果一致的选项是( )int i=1;int sum=0;while(i<=100){ if(i%2==0) { sum=sum+i;} i++;}
    A: for (int x =1; x<=100;x++){ sum=sum+x;}
    B: for (int x =0; x<=100;x+=2){ sum=sum+x;}
    C: for (int x =1; x<=100;x+=2){ sum=sum+x;}
    D: 上述全对