#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int c=0,d;
char str[30];char *a,*b;
clrscr();
printf("Enter the string:");
scanf("%s",str);
a=str;
for(a=str; *a!='\0';a++);
--a;
for(b=str; *b==*a; b++)
{
c=c+1;
--a;
}
d=strlen(str);
if(c==d)
printf("\nGiven String is Palindrome");
else
printf("\nGiven string is not palindrome");
getch();
}
Sample Output:
#include<conio.h>
#include<string.h>
void main()
{
int c=0,d;
char str[30];char *a,*b;
clrscr();
printf("Enter the string:");
scanf("%s",str);
a=str;
for(a=str; *a!='\0';a++);
--a;
for(b=str; *b==*a; b++)
{
c=c+1;
--a;
}
d=strlen(str);
if(c==d)
printf("\nGiven String is Palindrome");
else
printf("\nGiven string is not palindrome");
getch();
}
Sample Output:
No comments:
Post a Comment
Let Us hear Your thoughts about this Post.. Its Our Pleasure to get your feedback..