Check whether the string entered is a palindrome or not, C/C++ Programming

Program is to check whether the string entered is a palindrome or not:

Program is to check whether the string entered is a palindrome or not invoke function from main

int palindrome(char *st);

 

void main()

 {

 clrscr();

 int x;

 char *st;

 int ans;

 cout<<" enter the string ";

 cin>>st;

 ans=palindrome(st);

 if (ans==0)

    cout<<" the string is palindrome ";

 else

  cout<<" the string is not a palindrome ";

 }

 

 int palindrome(char *st)

  {

  int i;

  int l=strlen(st);

  for(i=0;i

    {

    if (st[i]!=st[l-1-i])

                return 1;

    }

    return 0;

  }

 

 

Posted Date: 10/19/2012 7:56:38 AM | Location : United States







Related Discussions:- Check whether the string entered is a palindrome or not, Assignment Help, Ask Question on Check whether the string entered is a palindrome or not, Get Answer, Expert's Help, Check whether the string entered is a palindrome or not Discussions

Write discussion on Check whether the string entered is a palindrome or not
Your posts are moderated
Related Questions
C Program for SORTING OF LONG WORD WITH ONE STRING #include stdio.h> #include conio.h> #include string.h> void main() {           char n[50],c[25][25];

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

how many types of loops are there and whay are they and what are its uses


Develop a C++ program that uses a while to determine the gross pay (in Dollars) for each of several employees. The company pays “straight-time” for the first 40 hours worked by eac

Hi is there any chance to get assignment for fresher tutor

C Program for FUNCTION OF MERGE #include conio.h> #include stdio.h> char cot(char a[],char b[]); void main() {           char a[50],b[50];           clrscr()

Write a program called OddEven that will prompt the user for an integer and print/display a message indicating whether it is even or odd. Continue prompting for numbers from the us

Pointers to Objects Passing and returning of objects is, though, not very efficient since it includes passing and returning a copy of the data members. This problem can be elim