The failure rate of FizzBuzz has always struck me as depending on the idea that you can do a lot of programming and just never need that operator.
The failure rate of FizzBuzz has always struck me as depending on the idea that you can do a lot of programming and just never need that operator.
But without any "real" math at all you can do it with, eg, two counters and some if statements. Or if you recognise that there's a repeating pattern you can work out that pattern manually and just write code to emit it over and over.
So even in a language w/o a mod operator, it's not a hard problem if you understand how to solve problems with code.
At least for me it would be sufficient if the person used a function like IsMultipleOf(x, m), or Remainder(x, n). This would at least make it clear what the function did even if they didn't get the exact operator.
The other thing to note is that the mod operator works differently on different languages and platforms.
Not with positive inputs, which is the domain of FizzBuzz.
Even if you don't know what "mod" means, if you have no idea know what a remainder is, and that the problem calls for it, and you can't derive the mod operator using integer addition, subtraction, multiplication, and division, then your math and problem solving skills are pretty weak, which FizzBuzz tests.
for (…) {
heavy_op();
if (i % 100 == 0) {
printf("not dead");
}
ClassicI only know it well because it was covered near the beginning of one of the first programming books I picked up (on Perl 5) and it stuck with me because it seemed wild to me that they had an operator for that.