#include <stdio.h>
#include <string.h>
int is_Palindrome_String(const char* str) {
int len = strlen(str);
int i, j;
for (i = 0, j = len - 1; i < j; i++, j--) {
if (str[i] != str[j]) {
return 0; // Not a palindrome
}
}
return 1; // Palindrome
}
int is_Palindrome_Number(int num) {
int reversedNum = 0;
int originalNum = num;
while (num > 0) {
int remainder = num % 10;
reversedNum = reversedNum * 10 + remainder;
num /= 10;
}
return (originalNum == reversedNum) ? 1 : 0;
}
int main() {
// Palindrome string example
char str[100];
scanf("%s", str);
if (is_Palindrome_String(str)) {
printf("%s is a palindrome string.\n", str);
} else {
printf("%s is not a palindrome string.\n", str);
}
// Palindrome number example
int num;
scanf("%d", &num);
if (is_Palindrome_Number(num)) {
printf("%d is a palindrome number.\n", num);
} else {
printf("%d is not a palindrome number.\n", num);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: