Print the numbers in the range with following constraints. if number is multiple of 3 print fuzz if number is multiple of 5 print buzz if number is multiple of 3 and 5 print fizzbuzz
sample input: sample output
2 1
2
3 15 Fizz
1
2
Fizz
4
Buzz
Fizz
7....
fizzbuzz
I'm new to this programming.I've tried like this. I'm making some mistake please someone suggest some solution.Thanks in advance
for i in range (1,15):
if(i%3 ==0):
print("fizz")
elif(i%5==0):
print("buzz")
elif(i%3 ==0 and i%5==0):
print("fizzbuzz")
else:
print(i)
Actual output which i got
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14