adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in C to check the given string is palindrome or not.

Write a program in C to check the given string is palindrome or not.

#include<stdio.h>
#include<string.h>
#include<conio.h>
   void main()
     {
      int i,j=0;
      char str1[100],str2[100]={0};
      printf("Enter a string:-");
      gets(str1);
      for(i=strlen(str1)-1;i>=0;i--)
         {
          str2[j++]=str1[i];
          }
      printf("The reverse of the given string is  %s\n",str2);
   if(strcmp(str1,str2)==0)
     printf("The given string is palindrome\n");
   else 
     printf("The given string is not palindrome\n");
   getch();
  }
Output:- 





Related Programs :-

Post a Comment

0 Comments