Skip to Content

Halving game

Level A. Teaches var, floor division, % and ranges wider than 32 bits.

You are given an integer n (1 ≤ n ≤ 10¹⁸). While n is even, halve it. Print how many times you halved it, then the odd number that is left.

Input: one integer n. Output: two integers on one line.

InputOutput
403 5
7 tests · Ctrl+Enter