Question: Write a program to check numbers from 1 to 20:
If a number is divisible by 3, print "Fizz".
If divisible by 5, print "Buzz".
If divisible by both, print "FizzBuzz".
Otherwise, print the number itself.
Python Code:
# Loop from 1 to 20
for num in range(1, 21):
if num % 3 == 0 and num % 5 == 0:
print("FizzBuzz")
elif num % 3 == 0:
print("Fizz")
elif num % 5 == 0:
print("Buzz")
else:
print(num)