write a program to accept a string and find out if it is a palindrome
1
Expert's answer
2016-01-19T08:44:11-0500
#include <stdio.h>
int isPalindrome(char *str);
int main() { char str[100]; printf("Enter your string:"); scanf("%s", str); if(isPalindrome(str) == 1) printf("It is palindrome.\n"); else printf("It is NOT palindrome.\n"); }
int isPalindrome(char *str) { int i, len = 0; while (str[len] != '\0') len++; for(i = 0; i < len/2; i++) { if(str[i] != str[len - 1 - i]) return 0; } return 1; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment