Multiples of a Number

2つの数値xとnがあり、nは2の累乗である。
x <= nの倍数 となる最小のnの倍数を出力せよ。

input
カンマ区切りの最初の値がx
2つ目の値がn

13,8
17,16

output

16
32

設問

Description:

Given numbers x and n, where n is a power of 2, print out the smallest multiple of n which is greater than or equal to x. Do not use division or modulo operator.

Input sample:

The first argument will be a text file containing a comma separated list of two integers, one list per line. e.g.

13,8
17,16
>||
Output sample:

Print to stdout, the smallest multiple of n which is greater than or equal to x, one per line.
e.g.
>||
16
32

やってみた

#!/usr/bin/env ruby

def multiple_num(x, n)
  i = 1
  i += 1 until x <= n*i
  n*i
end

ARGF.lines do |line|
  x,n =line.split(',').map(&:to_i)
  puts multiple_num(x, n)
end