1. 常規:
#include <stdio.h>int main(void){ int i; for (i = 0; i
#include <stdio.h>int main(void){ int i; for (i = 0; i 4) printf("%d\n", i); else printf("*\n"); } getchar(); return 0;}
2. && 與 ||
#include <stdio.h>int main(void){ int i; for (i = 0; i 3 && i
#include <stdio.h>int main(void){ int i; for (i = 0; i 7) { printf("%d\n", i); } } getchar(); return 0;}
3. & 與 |
#include <stdio.h>int main(void){ int i; for (i = 0; i 3 & i
#include <stdio.h>int main(void){ int i; for (i = 0; i 7) { printf("%d\n", i); } } getchar(); return 0;}
4. !
#include <stdio.h>int main(void){ int i; for (i = 0; i 4)) { printf("%d\n", i); } } getchar(); return 0;}
5. 梯次:
#include <stdio.h>int main(void){ int i; for (i = 0; i
6. 嵌套:
#include <stdio.h>int main(void){ int i; for (i = 0; i 2) { if (i%2 == 0) { printf("%d\n", i); } } } getchar(); return 0;}
7. 簡化的 if 語句(?
#include <stdio.h>int main(void){ int i,j; for (i = 0; i
#include <stdio.h>int main(void){ int i,j; for (i = 0; i