1、
do + 循環體 + while語句;當while語句不為0時,會繼續循環,當while語句為0時,跳出循環。
#include <stdio.h> int main(void) { int i, j; ##(僅在循環體使用的變量要在復合語句(程序塊)中進行聲明。???) do { puts("please input the i value:"); printf("i = "); scanf("%d", &i); if (i % 2) puts("odd"); else puts("even"); puts("please input the j value, 0: continue; other: quit."); printf("j = "); scanf("%d", &j); } while (j == 0); ## 當 while語句不為0時,會繼續循環,即j等於0時會繼續循環; 當while語句為0是,即j不等於0時會跳出循環。 return 0; }