write program for palindrome
Answer Posted / deepanjan
#include<stdio.h>
void main()
{
char ch[100];
int i,j,l,flag;
l=0;
flag=0;
printf("\n Enter to check if palindrome or not \n");
gets(ch);
for(i=0;ch[i]!='\0';i++)
{
l++;
}
for(i=0,j=l-1;i<(l/2)-1,j>(l/2);i++,j--)
{
if(ch[i]==ch[j])
flag=0;
else
{
flag=1;
break;
}
}
if(flag==0)
printf("\n Entered characters are palindrome");
else
printf("\n Entered characters are not a palindrome");
}
| Is This Answer Correct ? | 14 Yes | 15 No |
Post New Answer View All Answers
What are containers in c++?
What is stack unwinding?
Write a program which uses Command Line Arguments
Is c++ the most powerful language?
What are the effects after calling the delete this operator ?
Is c++ map a hash table?
What is the best book for c++ beginners?
Is c++ still in demand?
What is the difference between #import and #include in c++?
What is function overriding in c++?
What is public, protected, private in c++?
What is a constructor and how is it called?
what does the following statement mean? int (*a)[4]
Are c and c++ different?
Describe linkages and types of linkages?