2021-09-29 10:15:08 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main() {
|
2023-08-10 11:13:06 +02:00
|
|
|
unsigned long length;
|
|
|
|
scanf("%lu", &length);
|
|
|
|
for (unsigned long number = 1; number <= length; number++) {
|
2021-09-29 10:15:08 +02:00
|
|
|
bool is_divisible_by_3 = number % 3 == 0;
|
|
|
|
bool is_divisible_by_5 = number % 5 == 0;
|
|
|
|
if (is_divisible_by_3 && is_divisible_by_5) {
|
|
|
|
printf("FizzBuzz\n");
|
|
|
|
} else if (is_divisible_by_3) {
|
|
|
|
printf("Fizz\n");
|
|
|
|
} else if (is_divisible_by_5) {
|
|
|
|
printf("Buzz\n");
|
|
|
|
} else {
|
2023-08-10 11:13:06 +02:00
|
|
|
printf("%lu\n", number);
|
2021-09-29 10:15:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|