palindrome - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

palindrome

can someone help me.... how to create a program and tell the users if their input is a palindrome or not...... they say that i need to use array and looping...... how can i make it? pls help me........

sample:


wow palindrome.......

Comments

  • zibadianzibadian Posts: 6,349Member
    : can someone help me.... how to create a program and tell the users if their input is a palindrome or not...... they say that i need to use array and looping...... how can i make it? pls help me........
    :
    : sample:
    :
    :
    : wow palindrome.......
    :
    :
    That is quite simple. You need to user input in a string (which is an array). Then you need to loop through the Length() div 2 characters. Each of the ith-character needs to be the same as the Length()-ith-character. If that is true, then the string is a palindrome. It is best you assume that the string is a palindrome. Then you can simply prove that it is not, if a set of two characters (i, Length()-i) is not equal.
Sign In or Register to comment.