• 2022-06-07
    以下四个选项中和下面代码功能相同的是( )。(选择一项) 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: 上述全对