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
Out of fgets() and gets() which function is safe to use?
What is heap sort in c++?
Is c++ the hardest language?
Which c++ operator cannot overload?
What are the sizes and ranges of the basic c++ data types?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What can c++ be used for?
What is virtual base class?
What does new in c++ do?
What are the advantages of early binding?
Explain the concept of friend function in c++?
What's c++ used for?
Tell me an example where stacks are useful?
What are guid?
Can you write a function similar to printf()?