write program for palindrome
Answer Posted / sanmathi
#include<stdio.h>
#include<conio.h>
main()
{
char str1[20],rev[20];
int i,j=0;
clrscr();
printf("\n enter a word");
gets(str 1);
for(i=strlen(str 1)-1;i>=0;i--)
{
rev[j]=str[i];
j++;
}
rev[j]='\0';
printf("\n the given string is.........%s",str 1);
printf("\n the reversed string is .....%s",rev);
if(strcmp(str1,rev)==0)
{
printf("\n the given string is a palindrome");
}
else
{
printf("\n the given string is not a palindrome");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
When is the destructor called?
Should you pass exceptions by value or by reference?
Are there any special rules about inlining?
Can you explicitly call a destructor on a local variable?
Can a class be static in c++?
What is a string example?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Where Malloc(), Calloc(), and realloc() does get memory?
Differentiate between declaration and definition.
What is the C-style character string?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)
What is c++ iterator?
How do you write a function that can reverse a linked-list?
What is #include ctype h in c++?