Write a program that prints the numbers from 1 to 100. But for multiples of 3, print "Fizz" instead of the number, and for multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz". #148587
Answered
by
MMunim90
tawseef123
asked this question in
Programming Help
-
BodyWrite a program that prints the numbers from 1 to 100. But for multiples of 3, print "Fizz" instead of the number, and for multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz". Guidelines
|
Beta Was this translation helpful? Give feedback.
Answered by
MMunim90
Jan 6, 2025
Replies: 1 comment 1 reply
-
here is the answer for i in range(1, 101): |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
tawseef123
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is the answer
for i in range(1, 101):
if i % 3 == 0 and i % 5 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)