+ 1

Why it shows “odd”?

It should show “even” coz for example 4 % 2 = 0… https://code.sololearn.com/c8I2THnw5IME/?ref=app

28th Nov 2022, 1:13 PM
ПолинаС
3 Respostas
+ 2
number = gets.chomp.to_i # convert to int if number % 2 == 0 puts "even" else puts "odd" end # else use number.to_i
28th Nov 2022, 1:35 PM
Jayakrishna 🇮🇳
+ 1
Thanks :) didn’t know that
28th Nov 2022, 1:50 PM
ПолинаС