Palindrome


#include<iostream.h>
#include<conio.h>
#include<string.h>

void main()
{clrscr();
     char str[25],str1[25];	
     cout<<"Enter a string: ";
	
     gets(str);

     strcpy(str1,str);
     strrev(str);
	if(strcmp(str,str1)!=0)
	{
	     cout<<"string is not palindrome";
	}
	else
	{
	      cout<<"string is a palindrome";
	}

	  cout<<endl;
getch();
}

0 comments:

Post a Comment