+ 1
Why it shows “odd”?
It should show “even” coz for example 4 % 2 = 0… https://code.sololearn.com/c8I2THnw5IME/?ref=app
2 ответов
+ 2
number = gets.chomp.to_i # convert to int
if number % 2 == 0
puts "even"
else
puts "odd"
end
# else use number.to_i
+ 1
Thanks :) didn’t know that