/* Reversing a String */
#include
#include
#include
void main()
{
char s[20], r[20];
int i, l, j;
clrscr();
printf("\n Enter A String :");
scanf("%s", s);
l = strlen(s);
for((i=l-1;j=0;i>=0;i--,j++)
{
r[j] = s[i];
}
r[j] = '\0'];
printf("\n Given String : %s", s);
printf("\n Reversed String : %s", r);
if ((strcmp(s,r))==0)
printf("Palindrome");
else
printf("Not Palindrome");
getch();
}
2007-04-26
00:57:07
·
4 answers
·
asked by
robin j
1
in
Computers & Internet
➔ Programming & Design