Dude, you're not helping. You didn't explain anything. You're just giving him the answer. That might get him good grades for assignments, but it doesn't help him for classwork and exams. I know how fun it can be to write programs and show your skills. If you're going to do this, at least accompany it with verbose explanations of what you're doing and how you got what you got. Sheesh
.
Hmm. If you think this is so easy and need a challenge, why don't you write a compiler/interpreter and/or create a new programming language? I did
.