I failed this coding challenge because my solution "does not scale for new divisors and iterations"
I think it is actually a design (pattern) question, and would very much appreciate if anyone can describe a good high level solution (eg class relationships).
Write a program that will iterate though a sequence of integers starting from 0 up to
and including a number that can be passed in and the program will:
- output the number and “FOO” only when the integer is divisible by 3
- output the number and “BAR” only when the integer is divisible by 5
- but when the integer is divisible by both 3 and 5 then don’t write the above,
output the number and “BAZ” instead
Take into consideration that we might want to add new rules in the future including
different numbers, operators and iteration patterns.