fork download
  1. // when.c -- 何时退出循环
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. int n = 5;
  6. while (n < 7) // 第 7行
  7. {
  8. printf("n = %d\n", n);
  9. n++; // 第 10行
  10. printf("Now n = %d\n", n); // 第 11行
  11. }
  12. printf("The loop has finished.\n");
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
n = 5
Now n = 6
n = 6
Now n = 7
The loop has finished.