We have a sequence 1 2 4 8 16 32 64 128 …
If a number is given we have to tell its location with respect to the sequence.
[1] If the number given is same as one of the number in the sequence then we have to print the given number .
FOR EXAMPLE :- If the given no is 8 then we will print 8 as 8 is one of the number in the sequence. For 64 we will print 64.
[2] else If the number given is just more then one of the number of the sequence then we will print that no of the sequence.
FOR EXAMPLE :- if the number is 6 then we see that 6 is just more than the no 4 of the sequence than we will print 4. For 31 we will print 16.
HELP ME TO UNDERSTAND A LOGIC FOR THIS PROBLEM .