#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
void main()
{
char str[20],str1[20]={0};
int i,a,j=0;
char c;
clrscr();
printf("\nEnter the string");
scanf("%s",str);
a=strlen(str)-1;
i=a;
while(i>=0)
{
while(j<strlen(str))
{
str1[j]=str[i];
break;
}
i--;
j++;
}
j=0;
delay(600);
printf("\n\nThe entered string is = %s ",str);
delay(600);
printf("\n\nThe inverted string is = ");
printf("%s",str1);
a=strcmp(str,str1);
if(a==0)
{
delay(600);
printf("\n\nInput String = Inverted String. So");
delay(600);
printf("\n\nThe string is palindrome.");
}
else
{
delay(600);
printf("\n\nThe string is not palindrome");
}
getch();
}
No comments:
Post a Comment