write program for palindrome
Answer Posted / abhinav garg
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
int palindrome(char str[30],int len);
void main()
{ clrscr();
char str[50];
int len,a;
cout<<"Enter a string:";
gets(str);
len=strlen(str);
cout<<"\nLength of the string=>"<<len;
a=palindrome(str,len);
if(a==1)
cout<<"\n String is palindrome...";
else
cout<<"\n String is not a palindrome...";
getch();
}
int palindrome( char str[30],int len)
{ int flag=0,i;
for( i=0;i<len/2;i++)
{
if(str[i]==str[len-i])
flag=1;
}
return flag;
}
| Is This Answer Correct ? | 10 Yes | 13 No |
Post New Answer View All Answers
What is c strings syntax?
Describe the process of creation and destruction of a derived class object?
Can non-public members of another instance of the class be retrieved by the method of the same class?
What do you mean by public protected and private in c++?
Why is c++ called oops?
Explain "const" reference arguments in function?
Is arr and &arr are same expression for an array?
What are pointer-to-members? Explain.
What is the difference between object-oriented programming and procedural programming?
What is the most powerful coding language?
Difference between class and structure.
What is pointer with example?
Is c++ a low level language?
What is a node class in c++?
What is a down cast?