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