#include<iostream.h>
#include<conio.h>
#include<string.h>
main()
{
char str[50],str1[50];
int i,j;
clrscr();
cout<<"\n Enter A Length Of The String\n";
cin>>str;
for(i=0;str[i]!='\0';i++);
cout<<"\n The Length Of The Given String is \n"<<i;
for(j=0,i--;i>=0;j++,i--)
str1[j]=str[i];
str1[j]='\0';
cout<<"\n The Reverse Of Given String is \n"<<str1;
if(strcmp(str1,str)==0)
{
cout<<"\n Given String is Palindrome";
}
else
{
cout<<"\n Given String is not Palindrome";
}
getch();
}
#include<conio.h>
#include<string.h>
main()
{
char str[50],str1[50];
int i,j;
clrscr();
cout<<"\n Enter A Length Of The String\n";
cin>>str;
for(i=0;str[i]!='\0';i++);
cout<<"\n The Length Of The Given String is \n"<<i;
for(j=0,i--;i>=0;j++,i--)
str1[j]=str[i];
str1[j]='\0';
cout<<"\n The Reverse Of Given String is \n"<<str1;
if(strcmp(str1,str)==0)
{
cout<<"\n Given String is Palindrome";
}
else
{
cout<<"\n Given String is not Palindrome";
}
getch();
}
No comments:
Post a Comment