-->

Facebook

Jasper Roberts - Blog

Wednesday, April 8, 2015

Find given string is palingrom or not using string library function.

#include<stdio.h>
#include<conio.h>

void main()
{
   char str1[50], str2[50];
   clrscr();

   printf("\n Enter the first string:");
   gets(str1);

   strcpy(str2,str1);
 
strrev(str2);

   if (strcmp(str1,str2) == 0)
{
      printf("Entered string is a palindrome.\n");
}
   else
{
      printf("Entered string is not a palindrome.\n");
}

 getch();
}
OUTPUT:
Enter the first string: rever
Entered string is a palindrome.

No comments:

Post a Comment