/*STRING
PALINDROME*/
#include<stdio.h>
#include<conio.h>
void main()
{char a[50],b[50];
Int c,I,f,j;
c=0,f=0,j=0;
clrscr();
Printf(“enter the string”);
gets(a);
for(i=0,a[i]!=’\0’;i++)
c++;
for(i=c-1;i>=0;i--)
{b[ j]=a[i];
J++;
}
f=strcmp(a,b,c);
if(f==0)
printf(“\n the string is a
palindrome”);
else
prinf(“not palindrome”);
getch();}
OUTPUT
Enter the string
Malayalam
The sring is palindrome
Enter the string
Moon
The string is not a palindrome






0 comments:
Post a Comment