Ask Question
8 January, 01:46

A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed (i. e., reversing a palindrome produces the same string). Write a recursive, bool-valued function, isPalindrome that accepts a string and returns whether the string is a palindrome. A string, s, is a palindrome if: s is the empty string or s consists of a single letter (which reads the same back or forward), or the first and last characters of s are the same, and the rest of the string (i. e., the second through next-to-last characters) form a palindrome.

+5
Answers (1)
  1. 8 January, 04:39
    0
    Explanation: Palindrom. c

    #include

    #include

    int isPalindrome (char s[], int l);

    int main ()

    {

    char s[15];

    printf ("Enter a string: ");

    scanf ("%s", s);

    int result = isPalindrome (s, strlen (s));

    if (result) {

    printf ("Palindrome/n");

    }

    else{

    printf ("Not a palindrome/n")

    }

    return 0;

    }

    int isPalindrome (char s[], int l)

    {

    if (l<=0)

    return 1;

    if (s[0] = = s[l-1])

    {

    return isPalindrome (s+1, l-2);

    }

    else return 0;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed (i. e., reversing a palindrome produces the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers