write program for palindrome

Answer Posted / anonymous

#include<stdio.h>
#include<stdlib.h>
main()
{
int i,j,len=0;
char name[25];
printf("Enter the string");
scanf("%s",&name);
while(name[len]!='\0')
len++;
printf("\n%d",len);
for(i=0,j=len-1;i<len/2;i++,j--)
{
if(name[i]!=name[j])
{
printf("The string is not a palindrome");
exit(0);
}
}
else
{
printf("The string is a palindrome");
}
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a c++ map?

927


Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

742


What is the difference between multiple and multilevel inheritance in c++?

850


Can union be self referenced?

816


How to get the current position of the file pointer?

775


How the keyword struct is different from the keyword class in c++?

783


Is overriding possible in c++?

763


What is the difference between new() and malloc()?

1180


Explain function overloading and operator overloading.

813


Why do we use classes in c++?

798


What is the difference between #import and #include in c++?

818


How is computer programming useful in real life?

777


What is an html tag?

827


How are the features of c++ different from c?

792


Explain the uses oof nested class?

868