Menu

[Solved]Java Question Asked Many Times C T Seem Find Java Yi Moved Sweden Goes School First Years Q37151637

Java: This question has been asked many times in C, but I can’tseem to find out how to do it in Java

Yi has moved to Sweden and now goes to school here. The firstyears of schooling she got in China, and the curricula do not matchcompletely in the two countries. Yi likes mathematics, but now…The teacher explains the algorithm for subtraction on the board,and Yi is bored. Maybe it is possible to perform the samecalculations on the numbers corresponding to the reversed binaryrepresentations of the numbers on the board? Yi dreams away andstarts constructing a program that reverses the binaryrepresentation, in her mind. As soon as the lecture ends, she willgo home and write it on her computer.

Task

Your task will be to write a program for reversing numbers inbinary. For instance, the binary representation of 13 is 1101, andreversing it gives 1011, which corresponds to number 11.

Input

The input contains a single line with an integer N,1≤N≤10000000001≤N≤1000000000.

Output

Output one line with one integer, the number we get by reversingthe binary representation of N.

Expert Answer


Answer to Java: This question has been asked many times in C, but I can’t seem to find out how to do it in Java Yi has moved to Sw… . . .

OR


Leave a Reply

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