write program for palindrome
Answer Posted / neha
char a[20],b[20];
printf("enter a string");
scanf("%s",&a);
strcpy(b,a);//copies string a to b
strrev(b);//reverses string b
if(strcmp(a,b)==0)//compares if the original and reverse
strings are same
printf("\n%s is a palindrome",a);
else
printf("\n%s is not a palindrome",a);
return 0;
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is lvalue?
Is string data type in c++?
Should I learn c or c++ or c#?
What are virtual functions in c++?
What is the difference between cin.read() and cin.getline()?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
How do you write a function that can reverse a linked-list?
Where can I run c++ program?
Can create new c++ operators?
Define a nested class. Explain how it can be useful.
Tell me what are static member functions?
Should a constructor be public or private?
Explain what happens when a pointer is deleted twice?
What are static type checking?
What is the main function c++?