filmov
tv
#python 87 FizzBuzz Program In Python Programming | Computer Programming | #fizzBuzz #shorts #coding

Показать описание
FizzBuzz Program In Python Programming.
Suppose we have a number n. We have to display a string representation of all numbers from 1 to n, but there are some constraints.
If the number is divisible by 3, write Fizz instead of the number
If the number is divisible by 5, write Buzz instead of the number
If the number is divisible by 3 and 5 both, write FizzBuzz instead of the number
To solve this, we will follow these steps −
For all number from 1 to n,
if a number is divisible by 3 and 5 both, print “FizzBuzz”
otherwise when the number is divisible by 3, print “Fizz”
otherwise when the number is divisible by 5, print “Buzz”
otherwise, write the number as a string
#shorts #coding #python
#programming #fizzBuzz #python_coding
Suppose we have a number n. We have to display a string representation of all numbers from 1 to n, but there are some constraints.
If the number is divisible by 3, write Fizz instead of the number
If the number is divisible by 5, write Buzz instead of the number
If the number is divisible by 3 and 5 both, write FizzBuzz instead of the number
To solve this, we will follow these steps −
For all number from 1 to n,
if a number is divisible by 3 and 5 both, print “FizzBuzz”
otherwise when the number is divisible by 3, print “Fizz”
otherwise when the number is divisible by 5, print “Buzz”
otherwise, write the number as a string
#shorts #coding #python
#programming #fizzBuzz #python_coding