From d9347f25f7b229b7c4c5b181d47c28b380552114 Mon Sep 17 00:00:00 2001 From: poet-tldr Date: Sun, 3 Nov 2024 22:19:27 -0500 Subject: [PATCH] Wrote FizzBuzz program --- fizzbuzz.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fizzbuzz.py b/fizzbuzz.py index 218f7aa..f40ea7f 100644 --- a/fizzbuzz.py +++ b/fizzbuzz.py @@ -1,2 +1,12 @@ -# add your code here - +# print numbers 1-100. If divisible by 3, print Fizz. If divisible by 5, print Buzz. If divisible by 3 and 5, print FizzBuzz. +x = 1 +while x <= 100: + if x % 3 == 0 and x % 5 == 0: + print("FizzBuzz") + elif x % 3 == 0: + print("Fizz") + elif x % 5 == 0: + print("Buzz") + else: + print(x) + x += 1 \ No newline at end of file