Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. print("FizzBuzz Program")
  2. def fizzbuzz(n):
  3.     i = 1
  4.     while (i <= n):
  5.         if (i%3 == 0):
  6.             print("Fizz")
  7.         elif (i%5 == 0):  
  8.             print ("Buzz")
  9.         elif ((i%3 == 0) and (i%5 == 0)):
  10.             print("FizzBuzz")                    
  11.         else:
  12.             print(i)
  13.     i += 1
  14.    
  15.     return n
  16.    
  17.        
  18. fizzbuzz(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement