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 c++ runtime?
Write a program using display() function which takes two arguments.
How long it will take to learn c++?
What is late binding c++?
Explain how the virtual base class is different from the conventional base classes of the opps.
What does new do in c++?
What is the first name of c++?
Define virtual constructor.
What relational operators if statements in c++?
Describe linked list using C++ with an example.
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?
Differentiate between late binding and early binding.
What is the meaning of c++?
What is the use of string in c++?
what are the events occur in intr activated on interrupt vector table