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 is the use of setprecision in c++?
What is meaning of in c++?
Explain the isa and hasa class relationships.
Describe the process of creation and destruction of a derived class object?
What is iterator in c++?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What is the difference between C and CPP?
Can we run c program in turbo c++?
Which programming language should I learn first?
How to tokenize a string in c++?
What is purpose of abstract class?
What c++ library is string in?
what does the following statement mean? int (*a)[4]
What is a flag in c++?
What are the advantages of early binding?