From 94c9a71c1d91f0869c135888c0f5c937799a86d3 Mon Sep 17 00:00:00 2001 From: saikiranreddy27 <84696553+saikiranreddy27@users.noreply.github.com> Date: Mon, 24 May 2021 14:18:36 +1000 Subject: [PATCH] Create loop statements Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". --- Loop Statements | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Loop Statements diff --git a/Loop Statements b/Loop Statements new file mode 100644 index 0000000..88289a6 --- /dev/null +++ b/Loop Statements @@ -0,0 +1,21 @@ +numbers= 1 +sum = 0 +while(numbers<=100): + print(numbers) + sum = sum + numbers + numbers = numbers +1 + +print(sum) +for numbers in range(100): + if numbers%3 == 0: + print(numbers) + print("fizz") + continue + if numbers%5 == 0: + print(numbers) + print("buzz") +for numbers in range(100): + if numbers%3==0 and numbers%5 == 0: + print(numbers) + print("fizzbuzz") +