No, the results people have posted, with or without cheating, are all correct. You can get 12 as an output too, by using the %x tag to print in hexadecimal. If the answers are to be picked from a multiple choice list of 28 30 34 36 and 101010, you must have made a mistake when you copied the original question.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44016

33

posted Apr 11, 2008 07:53:00

0

Have you mistaken 0x10 for 0 multiplied by 10 (0*10)? If you were supposed to write 0x10, that would give one of the answers you listed. And as you have been asked, please post where you got the question from.

Originally posted by Campbell Ritchie: No, the results people have posted, with or without cheating, are all correct. You can get 12 as an output too, by using the %x tag to print in hexadecimal. If the answers are to be picked from a multiple choice list of 28 30 34 36 and 101010, you must have made a mistake when you copied the original question.

That's true. As Ulf suggested, you should have better Quoted your source, which would have avoided the confusions as Campbell pointed out -- misinterpreting the 0X as * (multiplication).

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44016

33

posted Apr 11, 2008 12:18:00

0

. . . and if I'm right, I can still get the result to print as 22!

Raghavan, sorry for confusing people, but I challenge you to work out how to get the result of 22 on screen.

Campbell, that's perfectly agreed. If you see my very first post i told that it looked like a puzzle wherein you are expected to bring a change in the output by just altering a single value or operator etc., -- Here it was achieved by changing the output formatter!

That's okay but people should get clarified rather than getting confused -- Right? [ April 11, 2008: Message edited by: Raghavan Muthu ]

shirsa ray chaudhuri
Greenhorn

Joined: Apr 08, 2008
Posts: 10

posted Apr 14, 2008 00:17:00

0

the answer is 36

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44016

33

posted Apr 14, 2008 02:28:00

0

Originally posted by shirsa ray chaudhuri: the answer is 36

Really? That doesn't look right to me. Please quote the question exactly as written, and tell us where you got it from.