Join 306,996 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,966 people online right now. Registration is fast and FREE... Join Now!
i think i would've told them not to ask stupid questions.
How is it a stupid question? Programming is more then being able to hammer out solutions. It's all about problem solving, abstract thinking, innovation, and so on.
i was joking. please don't lecture me about programming. chances are that i wrote my first program before you were born. a better question construct a program to raise each of these numbers (1,2,3,4) to each of these powers(0,1,2,3,4) without multiplying.
QUOTE(KYA @ 24 Nov, 2008 - 12:35 PM)
QUOTE(dbasnett @ 24 Nov, 2008 - 11:27 AM)
i think i would've told them not to ask stupid questions.
How is it a stupid question? Programming is more then being able to hammer out solutions. It's all about problem solving, abstract thinking, innovation, and so on.
This post has been edited by dbasnett: 25 Nov, 2008 - 05:43 AM
imho all of the answers given assumed restrictions not given. the only stated restriction was no multiply. so
CODE
Dim theNumbers() As Integer = New Integer() {1, 2, 3, 4} Dim thePowers() As Integer = New Integer() {0, 1, 2, 3, 4} Dim theAnsw As Integer For tn As Integer = 0 To theNumbers.Length - 1 For tp As Integer = 0 To thePowers.Length - 1 theAnsw = CInt(Math.Pow(theNumbers(tn), thePowers(tp))) 'or 'theAnsw = CInt(theNumbers(tn) ^ thePowers(tp)) Debug.WriteLine(theAnsw.ToString) Next Next
How is it a stupid question? Programming is more then being able to hammer out solutions. It's all about problem solving, abstract thinking, innovation, and so on.
^ this?
It wasn't meant to be funny. Keep your "humor" to the lounge or to yourself.
Getting back on topic and away from the childish banter.
The question was pretty good actually. Such a simple topic yet a roundabout answer is necessary. It tests a programmer's ability to not only think non-linearly, but to think on your feet in an interview; where most people would feel a little pressure which is to be expected with day to day deadlines.