n = gets.to_i found = false (10..99).each do |num| tens = num / 10 ones = num % 10 if tens + ones == n puts "#{num} = #{tens} + #{ones} = #{n}" found = true end end puts "NO" unless found
8
17 = 1 + 7 = 8 26 = 2 + 6 = 8 35 = 3 + 5 = 8 44 = 4 + 4 = 8 53 = 5 + 3 = 8 62 = 6 + 2 = 8 71 = 7 + 1 = 8 80 = 8 + 0 = 8