palindrome - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.