A little coding exercise
I was asked to write a little PHP snippet on the spot during an interview for a job. I thought it was pretty fun so I’ll share it with you guys. I’ll modify the output a little bit but the concept is still the same. Needless to say, I got it right and I only had about 5 minutes to write it out on a sheet of paper :).
Write a little snippet that iterates from the numbers 1-100. On every number that is divisible by 3, output “Boom”. On every number that is divisible by 5, output “Fire”. If the number is divisible by 3 and 5, output “BoomFire”. Output the number on every other number.
Post your solution using the programming language of your choice in the comments.
whatever happened to good old fashioned crossword puzzles