#include #define NUM_DOORS 100 #define NUM_PASSES 100 int main() { int is_open[NUM_DOORS] = { 0 }; for (int pass = 0; pass < NUM_PASSES; pass++) { for (int door = pass; door < NUM_DOORS; door += (pass + 1)) { is_open[door] = !is_open[door]; } } printf("The following doors are open:"); for (int door = 0; door < NUM_DOORS; door++) { if (is_open[door]) { printf(" %d", (door + 1)); } } printf("\n"); return 0; }