Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write program for palindrome

Answer Posted / felix

#include<stdio.h>
#include<ctype.h>
#include<string.h>

int isPalindrome( char *s );

int main ( void )
{
int i = 0;
int ch;
char s[100];

while ((ch = getchar()) != '\n') {
if (isalpha(ch)) {
s[i] = ch;
i++;
}
}

if ( isPalindrome(s) == 1) {
printf("Yes, is a palindrome.\n");
} else {
printf("No, not a palindrome.\n");
}

return 0;

}

int isPalindrome( char *s )
{
int i = strlen(s)-1;
int j = 0;

while (j<=i) {
if(s[j] != s[i]) {
return 0;
}
i--;
j++;
}
return 1;
}

Is This Answer Correct ?    114 Yes 85 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor

1099


Can I learn c++ without c?

1086


What is a manipulative person?

941


Is c++ built on c?

965


Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].

1002


What is c++ virtual inheritance?

1071


Explain the uses of static class data?

1052


Can we specify variable field width in a scanf() format string? If possible how?

1149


What are the advantages of using friend classes?

1080


Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()

1464


When should I use unitbuf flag?

963


what is C++ objects?

1150


What are move semantics?

1079


What is doubly linked list in c++?

1025


How do you define/declare constants in c++?

1002