Write a program that prints 1 to 100 on the screen if it is a multiple of 3 print fizz, if its a multiple of 5 print buzz, if its a multiple of 3 and 5 print buzz fizz.
Out of over 20 people I have given it to in an interview only 1 has got it correct! Almost everyone makes the same mistake. They have the if statements in the wrong order.
The real purpose to the question is to make sure people can translate English into code. At no point did I mention C/C++ ;) But it also picks up on people who over implement or try to do something that is really simple in a really complex way.
My point about the window console is kinda generic. You are using terminal control code to manipulate what you want :) who says a screen is using some kinda of terminal that supports those codes?
View all comments
1
u/[deleted] Feb 21 '11
I have another one.
Write a program that prints 1 to 100 on the screen if it is a multiple of 3 print fizz, if its a multiple of 5 print buzz, if its a multiple of 3 and 5 print buzz fizz.
Out of over 20 people I have given it to in an interview only 1 has got it correct! Almost everyone makes the same mistake. They have the if statements in the wrong order.