Coding | Practice Questions Daily | C | C++ | Python | Java: post #112 — TG.ME

• FizzBuzz

The FizzBuzz challenge is a popular problem in technical interviews. For a given maximum input value n, create a function that outputs integers from 1 to n.
But, if an integer is divisible by three, then the number should be replaced with the word “Fizz.” Numbers divisible by five should say “Buzz” instead. And numbers divisible by both three and five should say “FizzBuzz.”

For example, with an input of 17, the output should be:

[1, 2 , ”Fizz”, 4, “Buzz”, “Fizz”, 7, 8, “Fizz“, “Buzz“, 11, “Fizz”, 13, 14, “FizzBuzz”, 16, 17]

Solve in Language : Kotlin or Any

Join @coding_practice_questions
👍1
May 9, 2023 15.6K 16 17