Latest

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.


Comments

Steph 12 May 08, 2:38pm

whatever happened to good old fashioned crossword puzzles


Make a comment

Rules

TwinArrow is a blog managed by Huy, Dave, Jon and Scott. We write about technology, software, advertisements and pretty much anything we can think of.

QUICKIES

I’ve been the target for comment spam!! I’ve installed the Askimet filter to help prevent any further spam!

I wish I have a working camera, especially a DSLR. There are many things I want to take pictures of and post it. A DSLR is kinda too bulky, I might look into some good Point and Shoots.

CATEGORIES

FRIENDS

FRESH SITES