MINET 2004 (Two programmers’ nightmare)

“Well I think this will work”

{The program is executed [ALT]+[F9] and when prompted 825 is entered}

(0 1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)

“YES!! Now we need a for loop to do the same for all numbers from 2 till the number entered”

{For loop added and again [ALT]+[F9], 5 is entered}

(Division Error)

“What! How can we have a division error, lets check”

{For loop is made a comment, and again [ALT]+[F9] then 825 is entered}

(0 1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2636)

“What the hell is this?? From where did that number come from?? lets recheck”

{Execued again and 825 is entered}

(0 1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -16)

“That is impossible!! I think we should check where the program is going wrong”

{A cout< < command is added in the first loop, execued again and 825 is entered}
(0 1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)

“Finally! We again have the right output”

{Comment from for loop is removed, execued again and 5 is entered}

(Division Error)

“Oh no! not again, lets put more cout< < statements"

{cout< < is added in the nested loops, executed again, 5 is entered}
(3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)

“How can a cout< < statement solve a division error??"

Key:-

” ” – Our thoughts

{ } – Narration

( ) – Computer output

Those who have sympathy with us please post your comment.

Those who want to try the questions can get it here.

We have tried our best to copy the question paper exactly (including spaces, font etc.) in case some error creeps in, we apologise.

PRATEEK RUNGTA and SOUVIK DAS GUPTA

Leave a Reply

Your email address will not be published. Required fields are marked *