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
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
What is the difference between #import and #include in c++?
Explain what are accessor methods?
How can virtual functions in c++ be implemented?
What is the use of dot in c++?
How much do c++ programmers make?
What is meant by forward referencing and when should it be used?
What are the unique features of C++.
What's the "software peter principleā?
What is c++ coding?
Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
What are the advantages of inheritance in c++?
Where is atoi defined?
Where and why do I have to put the "template" and "typename" keywords?
What is c++ array?