Find string palindrome 10marks

Answer Posted / coolcom(chandan)

void main()
{
int a,len,palin;
char s[20];

scanf("%s",s);

len=strlen(s);
printf("%d \n",len);

for(a=0,len=len-1;a<len;a++,len--)
{
palin=0;
if(s[a]==s[len])
palin=1;

else
{
printf("string %s is not palindrome",s);
getch();
exit();
}
}
printf("string %s is palindrome",s);
getch();

}

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use return in c?

567


What are the usage of pointer in c?

701


What is time complexity c?

565


What is use of integral promotions in c?

663


Explain the difference between the local variable and global variable in c?

599






Describe newline escape sequence with a sample program?

653


Is return a keyword in c?

597


What is difference between union All statement and Union?

628


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2172


All technical questions

1508


How can I invoke another program or command and trap its output?

611


Explain union.

633


What is a char c?

589


Who developed c language?

637


What is the difference between Printf(..) and sprint(...) ?

781