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 do we run a shell in the unix system?
What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard
What is the function of I/O library in C++ ?
Why is null pointer used?
Difference between pass by value and pass by reference?
What is c++ in english?
Explain the difference between c & c++?
What is a set in c++?
What do nonglobal variables default to a) auto b) register c) static
Which bit wise operator is suitable for putting on a particular bit in a number?
Define a pdb file.
What is stack unwinding?
What do you mean by volatile and mutable keywords used in c++?
What are c++ tokens?
What is abstraction in c++ with example?