1.

Solve : need help please.... with turbo C?

Answer»

guys i NEED help... my teacher wanted us to make a program that gets a name 50 letters and displays it BACKWARDS like level=level and PRINTS whether it is a palindrome or not
here it is


create a C program called palindrome(), that will ask the user to enter a word. Then the program will change the word entered in its reverse order. If the Word in reverse form is still the same word, then it is a palindrome, otherwise it is not a palindrome.

sample output:

Enter a Word: Level
level is a palindrome


Enter a Word: Hello
olleh is not a palindrome
its on Turbo C guys...please need some help
what do you have so far? Any ideas on how you'd go about it? (algorithm?)I think the lesson is probably over.thats so easy
Code: [Select]int palindrome(char *input){
char BUFFER[49],buffer2[49];
strcpy(buffer, input);
strcpy(buffer2, input);
strrev(buffer);
if(strcmp(buffer, buffer2) == 0){return (1);}
return (0);
}
returns 1 if it is a palindrome and 0 if it is not



Discussion

No Comment Found