Fizz Buzz - aloalgo

Fizz Buzz

Easy

You are given a single integer, n.

Your task is to implement a function that returns a specific string based on the divisibility of n by 3 and 5.

Return:

  • The string "fizzbuzz" if n is divisible by both 3 and 5.
  • The string "fizz" if n is divisible by 3 but not by 5.
  • The string "buzz" if n is divisible by 5 but not by 3.
  • The string representation of n itself if n is not divisible by either 3 or 5.

Example 1

Input
3
Output
"fizz"
Explanation:

3 is divisible by 3.

Example 2

Input
5
Output
"buzz"
Explanation:

5 is divisible by 5.

Example 3

Input
15
Output
"fizzbuzz"
Explanation:

15 is divisible by both 3 and 5.

Example 4

Input
7
Output
"7"
Explanation:

7 is not divisible by 3 or 5.

Loading...
Input
3
Output
"fizz"

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!