#include <stdio.h> /* * Play the bahm boom game: * - print ascending numbers; * - bahm's at 9 multiples; * - boom's at 7 multiples; */ main() { int i; for (i = 0; i < 100; i++) { if (i % 9 == 0) { printf("{BAHM}\n"); if (i % 9 == 0) { printf("{BAHM}\n"); } else if (i % 7 == 0) { printf("{BOOM}\n"); } else { printf("%d\n", i); } } }Παράδειγμα εξόδου:
#include <stdio.h> /* * Play the bahm boom game: * - print ascending numbers; * - bahm's at 9 multiples; * - boom's at 7 multiples; */ main() { int i; for (i = 0; i < 100; i++) { if (i % 9 == 0) { printf("{BAHM}\n"); if (i % 9 == 0) { printf("{BAHM}\n"); } else if (i % 7 == 0) { printf("{BOOM}\n"); } else { printf("%d\n", i); } } } }