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 are the events occur in intr activated on interrupt vector table
What are special characters c++?
Why use of template is better than a base class?
Differentiate between a copy constructor and an overloaded assignment operator.
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
What is c++ good for?
What do you mean by early binding?
What is ios in c++?
Is there structure in c++?
How new/delete differs from malloc()/free?
Can you please explain the difference between static and dynamic binding of functions?
Which is the best c++ software?
What is the purpose of template?
What is an html tag?
What is the difference between the compiler and the preprocessor?