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 ios in c++?
What are static type checking?
What is buffering in c++?
What is a multimap c++?
What is istream c++?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What is atoi in c++?
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
What is the difference between struct and class?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
Comment on assignment operator in c++.
What are the advantages of pointers?
What is unary operator? List out the different operators involved in the unary operator.
What is == in programming?
Explain what is polymorphism in c++?