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
Does c++ have foreach?
What is ios class in c++?
Write a program which uses functions like strcmp(), strcpy()? etc
What is c++ course?
what is pre-processor in C++?
What is a dangling pointer in c++?
Is c++ built on c?
What things would you remember while making an interface?
What do you understand by a pure virtual member function?
what is oops and list its features in c++?
When does a 'this' pointer get created?
What is heap sort in c++?
What are friend functions in C++?
What is rvalue?
What do you mean by public protected and private in c++?