+ 1
Why it shows âoddâ?
It should show âevenâ coz for example 4 % 2 = 0⊠https://code.sololearn.com/c8I2THnw5IME/?ref=app
3 RĂ©ponses
+ 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