# jKafer on the Net

February 15th, 2012 at 5:52 pm

During a recent job interview, I was given a programming test / quiz – which I botched up royally – I froze. And no, I didn’t get the job. So in the spirit of my math teachers – I’m going to ‘Show My Work’.

The test was to write the code to display numbers 1-100, if divisible by 3 – write “Yeah”, if divisible by 5 – write “Baby”, if divisible by both – “Yeah Baby”. I didn’t freeze because I didn’t know how to do the “for/while” statements/loop or the “if” statements, it was because I had never had to check for a WHOLE number before. So my mind was racing on a small detail of the question – in my mind an important part of the question (but not to them I guess). Well, I now know how to check for a whole number in 3 different ways. Something learned!!!

So here are my 3 versions (I have a tendency to be dramatic you know):

## JavaScript:

```<script type="text/javascript">
function YB(){
for(i=1;i<=100;i++)
{
x = i/3;
y = i/5;
if(x == parseInt(x)){
a = " Yeah";
}
if (y == parseInt(y)){
a = a+ " Baby";
}

document.write(i+" "+a+" <br />");
a = "";
}
}

</script>```

## PHP:

```for (\$i =1; \$i<=100; \$i++)
{
if(\$i % 3 == 0){
\$a = " Yeah";
}
if(\$i % 5 == 0){
\$a .= " Baby";
}
print \$i." ".\$a."<br />";
\$a = "";
}```

### Java:

```public class yeahBaby{
public static void main(String[] args) {
for(double i =1; i <= 100; i=i+1)
{
String a = "";
double x = i/3;
double y = i/5;
if(x == Math.rint(x)){
a = " Yeah";
}
if(y == Math.rint(y)){
a = a+ " Baby";
}
System.out.println(Math.round(i)+" "+a);
}
}
}```

-

• ## Quilting Projects I Want to Make

• Ombre Mountains Quilt Pattern by BusyHandsQuilts.com is a modern design that creates an ombre effect. The pattern includes all the sizes from Baby to King. #busyhandspatterns #ombremountainsquilt #ombrequilt #modernquilting

• Homecoming Quilt- My Peppered Cotton version & tester quilts! – Lo & Behold Stitchery

• Homecoming Quilt- My Peppered Cotton version & tester quilts! – Lo & Behold Stitchery

• On the Edge is a quick and fun modern quilt pattern with a lot of custom design possibilities! This PDF pattern includes directions for making a twin-size quilt (72 x 96), a throw-size quilt (56 x 64), a baby size (38.5 x 44), and a pillow/mini quilt (18 x 18). See the Instagram hashtag

• ## Latest Pins on Pinterest

• Crystals Stones: #Crystal Care. More

• Life path numbers and gemstones, #crystalhealing Believe in numbers

• Love & Inspiration

• Now that I am Married to the most incredible, caring, strong, respectful, sexiest guy in the whole world. I now understand my worth. Best Husband in the whole world!!

• 20 Amazing Quotes About Life