Faux FizzBuzz

Report a typo

You are given a Map<String, Int> as input. Iterate through the map and for each value:

  • If the value is divisible by 3, print Fizz.

  • If the value is divisible by 5, print Buzz.

  • For values divisible by both 3 and 5, print Fizz first, then Buzz on the next line.

  • If the value is divisible by neither 3 nor 5, print FizzBuzz.

Each output (Fizz, Buzz, or FizzBuzz) should be printed on its own line.

Write a program in Kotlin
fun iterator(map: Map<String, Int>) {
// put your code here
}
___

Create a free account to access the full topic