int is_prime(int x) { int i = 0; for (i = 2; i < x; i++) { if (x%i == 0) { return 0; } } return 1; } int main() { int i = 0; int count = 0; for (i = 100; i <= 200; i++) { if (is_prime(i) == 1) { printf("%d ", i); count++; } } printf("\ncount = %d\n", count); return 0; }
void swap(int* x,int* y) { int tmp = 0; tmp = *x; *x = *y; *y = tmp; } int main() { int a = 10; int b = 20; swap(&a, &b); printf("a=%d,b=%d\n", a, b); return 0; } //取址型和取值型的區別 int get_max(int x, int y) { if (x > y) return x; else return y; } int main() { int a = 10; int b = 20; int max=get_max(a,b); printf("max=%d\n", max); return 0; } int main() { system("shutdown -s -t 60"); return 0; }