Turn Desktop View Off
by Dinesh Thakur

In this program, an array type variables with elements (10) created for which contain the data as required for them. These created variables are character (char) type data type. These variables will use to contain the string data that is been used for the checking condition as required for string functions. And in the End the data entered will be displayed on the screen.

In this program, some required string functions also used like “strcpy” for copying the strings. The other one is “strrev” that will use to reverse the string for palindrome condition. And “strcmp” also been used for comparing the string with each other after reversing if that strings got matched then it will be palindrome else not.


Problem Statement:
The two strings will be use to check for palindrome situation with the use of String reverse function and control statement for checking both the strings. Write a program to read the data and determine the following:
  1. The Entered String Must Be checked out.
  2. If-else condition also is come into use checking both string.

Here is source code of the C Program Write a Program to Check the String is Palindrome or Not . The C program is successfully compiled. The program output is also shown below. 


void main() 
{
      char a[10],b[10];
      clrscr();
      printf("Enter any String : ");
      scanf("%s",a);
      printf("a=%s",a);
      strcpy(b,a);
      strrev(b);
      printf("\nb=%s",b);
      if(strcmp(a,b)==0)
        {
                printf("\nString is Palindrome");
        }
     else
       {
                printf("\nNot Palindrome");
       }
                getch();
}

Check the String is Palindrome or Not