Nearest Power Of Two

Nearest Power Of Two

Medium Computer Mathematics Integers & Divisibility 34 views
Explanation Complexity

Problem Statement

Given n>0, print the smallest power of 2 that is >= n.

Input Format

One integer n.

Output Format

One integer.

Example

9
16

Constraints

1

Input / Output Format

Input Format
One integer n.
Output Format
One integer.
Constraints
1

Examples

Input:
9
Output:
16

Example Solution (Public)

Computer Mathematics
Start p=1 and keep doubling while p<n. Output p.

Official Solution Code

Start p=1 and keep doubling while p<n. Output p.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.