- Program :
#include <string.h>
void isPalindrome(char str[])
{
int l = 0;
int h = strlen(str) - 1;
while (h > l)
{
if (str[l++] != str[h--])
{
printf("\n%s is Not Palindrome", str);
return;
}
}
printf("\n%s is palindrome", str);
}
int main()
{
printf("\n----------------PALINDROME OR NOT----------------");
isPalindrome("madam");
isPalindrome("moni");
isPalindrome("wow");
return 0;
}
- Output :
No comments:
Post a Comment