def ispal? n
if n.to_s.reverse == n.to_s
return true
else
return false
end
end
cand = []
for i in 100..999
for j in 100..999
p = i*j
if ispal?(p)
cand.push(p)
end
end
end
puts cand.max
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.