Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print "Please enter a word: "
- word = gets.chomp
- is_palindrome = true
- (0..word.length/2).each do |x|
- if word[x] != word[-(x+1)]
- is_palindrome = false
- break
- end
- end
- if is_palindrome
- puts "\"#{word}\" is a palindrome"
- else
- puts "\"#{word}\" is not a palindrome"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement