#include <stdio.h>
#include <string.h>
void Lower_case(char str[]) {
int i = 0;
while (str[i] != '\0') {
if (str[i] > 64 && str[i] < 91)
str[i] += 32;
i++;
}
}
void CheckPalindrome(char str[])
{
int left = 0;
int right = strlen(str) - 1;
while (right > left)
{
if (str[left++] != str[right--]) {
printf("The String %s is not a palindrome", str);
return;
}
}
printf("The String %s is palindrome", str);
}
int main()
{
char str1[50];
printf("enter a string");
gets(str1);
Lower_case(str1);
CheckPalindrome(str1);
return 0;
}
No comments:
Post a Comment