write program for palindrome

Answer Posted / mohammed arif khan

//MOHAMMED ARIF KHAN
// PROGRAM OF PALIDROM

#include<stdio.h>
#include<conio.h>
void main()
{
char str[20],*ptr,*ptr1;
int c=0;
clrscr();
printf("Enter the string:");
scanf("%s",&str);
for(ptr1=str;*ptr1!='\0';ptr1++);

ptr1--;
for(ptr=str;*ptr!='\0';ptr++,ptr1--)
{
if(*ptr!=*ptr1)
{
c=1;
break;
}
}
if(c==0)
{
printf("\n palindrome");
}
else
{
printf("\n not palindrome");
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the extraction operator and what does it do?

810


Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?

1928


How can we access protected and private members of a class?

824


What is command line arguments in C++? What are its uses? Where we have to use this?

847


Will this c++ program execute or not?

791


What are the important differences between c++ and java?

825


What are punctuators in c++?

859


Using a smart pointer can we iterate through a container?

801


How many keywords are used in c++?

765


What are the different types of comments allowed in c++?

768


When should we use multiple inheritance?

797


Explain function overloading and operator overloading.

812


Explain stack unwinding.

831


How do we implement inheritance in c++?

817


What does n mean in c++?

832