write program for palindrome

Answer Posted / mojib khan

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[30],str2[30];
int l;
clrscr();
printf("Enter the string \t");
gets(str1);
strrev(str1);//for reverse string
strcpy(str1,str2);//copy str1 to str2
l=strcmp(str2,str1); //comparing strings it will return 0/1
if(l==0)
{
printf("\nString is Palindrom");
}
else
printf("String is not palindrom");
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I start a c++ project?

789


What are the two main components of c++?

827


What is c++ used for in games?

817


What is the use of setfill in c++?

800


Explain Text Manipulation Routines?

837


When can I use a forward declaration?

814


What are friend classes? What are advantages of using friend classes?

853


What do you mean by “this” pointer?

802


Mention the ways in which parameterized can be invoked.

725


Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.

2286


What are shallow and deep copy?

845


Can member data be public?

778


What is the difference between while and do while loop? Explain with examples.

848


Why do we use double in c++?

806


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1045