Company: Saleforce
Difficulty: medium
You're given a number n . For every integer i from 1 through n, output the following: FizzBuzz when i divides evenly by both 3 and 5 Fizz when i divides evenly by 3 alone Buzz when i divides evenly by 5 alone Otherwise, just output i itself Each result belongs on its own line. Example Take n = 15. Output: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz Explanation 3, 6, 9, and 12 divide evenly by 3 but not 5, so those lines show Fizz . 5 and 10 divide evenly by 5 but not 3, so those lines show Buzz . 15 divides evenly by both 3 and 5, so that line shows FizzBuzz . Every other value divides evenly by neither, so those lines just show i itself. Constraints 0 < n < 2 × 10 5