与语句“for(k=0;k<=10;++k)sum+=k; ”不等价的语旬是
A.k = 0; while (1) { sum += k; if (++k >10) break; } B.k=0; while (k <= 10) { sum+=k++; if (k> 10) break; } C.k = 0; do {sum +=k;} while(k++<= 10); D.k = 0; while (k<= 10) sum+=k++;正确答案C
与语句“for(k=0;k<=10;++k)sum+=k; ”不等价的语旬是
A.k = 0; while (1) { sum += k; if (++k >10) break; } B.k=0; while (k <= 10) { sum+=k++; if (k> 10) break; } C.k = 0; do {sum +=k;} while(k++<= 10); D.k = 0; while (k<= 10) sum+=k++;正确答案C