Find string palindrome 10marks

Answer Posted / babitha

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--)
{
if(s[a]==s[len])
palin=1;

else
break;
}

if(palin==1)
printf("string %s is palindrome",s);
else
printf("string %s is not palindrome",s);

getch();

}

Is This Answer Correct ?    18 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between linking and loading?

689


Explain what is the use of a semicolon (;) at the end of every program statement?

731


How can I sort a linked list?

633


Is c still relevant?

637


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

805






What is dynamic memory allocation?

804


Explain how do you print only part of a string?

647


What is c programing language?

612


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2005


Explain how can you check to see whether a symbol is defined?

659


What are nested functions in c?

562


What's the total generic pointer type?

611


What are the Advantages of using macro

680


Explain what is the difference between functions abs() and fabs()?

614


How to write a code for reverse of string without using string functions?

1576