Programme to check whether string is pallindrome or not.

                                  String is pallindrome or not

 This is the c languge code to check whether the string is pallindrome or not.

Pallindrome:  It is a string that reads the same backward as well as forward and can be                                       of   odd or even length.

                           Example: radar, madam, pop, lol, etc.

  
                       



My programme follow the following steps:
  1. Take string (let x) input from user.
  2. Copy that string into other string(let y).
  3. Then reverse the first string(x).
  4. Compare the  x and y.
  5. If both are same then x is pallindrome and if they are not same then x is not pallindrome.




Programme to check whether the string is pallindrome or not.



#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
   clrscr();
   char str1[30],str2[30];
   int i,option;
   printf("Enter string\n");
   gets(str1);
   strcpy(str2,str1);
   strrev(str1);
   option=strcmp(str1,str2);
   if(option==0)
   {
       printf("Given string is pallindrome\n");
   }
 else
  {
      printf("Given string is not pallindrome\n");
  }
    getch();
}
 


Hope you like this C programme.
If you like please don't be cheap to comment for any improvement.

  





Programme to check whether string is pallindrome or not. Programme to check whether string is pallindrome or not. Reviewed by Deepak kumar soni on December 27, 2018 Rating: 5

No comments:

Powered by Blogger.