This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programming Diversions and the fly likes Can you guess the output of this program ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Can you guess the output of this program ?" Watch "Can you guess the output of this program ?" New topic
Author

Can you guess the output of this program ?

salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

The puzzle is simple,
You have a program, you have to guess the output of this program, its not as simple as it looks.




You may use paper or calc, etc. If you want to know whats the right answer or you want to cheat, just run this program

All the best


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

for those requiring help:


Math.pow(x,y);
x to the power of y:
eg: Math.pow(2,3) = 2 to the power of 3 = 8
---------------------

x^y
This is called XORing, refer to XOR
eg: 12^23=27
---------------------


int x = a + b++;

is equivalent to

int x = a + b;
b = b + 1;
---------------------


post here for any more assistance...

 
 
subject: Can you guess the output of this program ?