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
Differentiate between the manipulator and setf( ) function?
What is a map in c++?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
Explain Text Manipulation Routines?
What is a rooted hierarchy?
Explain polymorphism?
Is java as fast as c++?
Define vptr.
What are separators in c++?
Write a code/algo to find the frequency of each element in an array?
Can I learn c++ in a week?
Is arr and &arr are same expression for an array?
What is setw manipulator in c++?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
What are vectors used for in c++?