#include <stdio.h>
#include <string.h>
int areEqual(const char *str1, const char *str2) {
return (strcmp(str1, str2) == 0);
}
int isPalindrome(const char *str) {
int left = 0;
int right = strlen(str) - 1;
while (left < right) {
if (str[left] != str[right]) {
return 0; // Not a palindrome
}
left++;
right--;
}
return 1; // Palindrome
}
int main() {
char str1[50], str2[50];
printf("Enter the first string:\n ");
scanf("%s",str1);
printf("Enter the second string:\n ");
scanf("%s",str2);
if (areEqual(str1, str2)) {
printf("Strings are equal.\n");
} else {
printf("Strings are not equal.\n");
}
if (isPalindrome(str1)) {
printf("String is a palindrome.\n");
} else {
printf("String is not a palindrome.\n");
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: