C++ Program to Check String is Palindrome or not

Here you will get C++ program to check string is palindrome or not.

A string is called palindrome if it is equal to its reverse. For example bob is string palindrome.

Output

Enter a string:saas

The string is Palindrome

17 thoughts on “C++ Program to Check String is Palindrome or not

    1. Neeraj Mishra

      A string is palindrome if first half is equal to second half. Therefor the 2nd loop run till half of the length of string.

      Reply
  1. kiruthinesan

    for(len=0;a[len]!=’’;++len);
    ” this symbol i could not understand.

    Reply
    1. Talha

      This if for getting the length of appropriate array. after writing a word or a paragraph the length is pointing at a final index. which is the length of an array.

      Reply
  2. Tamrat

    How can I write a c++ program that print the ff…
    5
    4 5 4
    3 4 5 4 3
    2 3 4 5 4 3 2
    1 2 3 4 5 4 3 2 1
    please help me…
    Thanks!

    Reply
    1. Durgesh

      #include

      int main()
      {
      int i,j,k;
      for(i = 5; i >= 1; i–)
      {

      for(j = i; j<5; j++)
      {
      std::cout <=i; k–)
      {
      std::cout << k;

      }
      std::cout<<std::endl;
      }
      return 0;
      }

      Reply
      1. Tamrat

        Thanks for the reply.
        I wonder if you see it and reply again.

        Reply
      2. Tamrat

        But, It is somehow tricky if the output is

        5
        4 5 4
        3 4 5 4 3
        2 3 4 5 4 3 2
        1 2 3 4 5 4 3 2 1

        I wonder if you do it in c++.
        Thanks anyways.

        Reply
  3. Alan Jose Tom

    sir how can i make the output like this
    *
    **
    **
    ***
    ***
    ***
    ****
    ****
    ****
    ****
    *****
    *****
    *****
    *****
    ***** and
    1
    23
    456
    78910

    Reply
  4. Ayush oberoi

    my compiler is giving problem in first for loop for(len=0;a[len]!=’’;++len); can you plz tell me what should i do to remove that problem.

    Reply
    1. Admin Post author

      There is a little mistake in code change a[len]!=’’ to a[len]!=’\0′

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *