1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| // 能4整除不能被100整除,能被400整除 #include <stdio.h> int main() { int i; int j; int count=0; for (i = 1000; i < 2000; i++) { if (i % 4 == 0) { if (i % 100 != 0) { printf("%d ", i); count++; } } if (i % 400 == 0) { printf("%d ", i); count++; } if (count >= 8) { count = 0; printf("\n"); } }
system("pause"); return 0; }
|