Apply for Zend Framework Certification Training

c




< longest word in a string Last >



#include <stdio.h>
#include <string.h>
int main() {
    char str[100];
    int i, length, isPalindrome = 1;
    printf("Enter a string: ");
    scanf("%s", str);
    length = strlen(str);
    for(i = 0; i < length / 2; i++) {
        if(str[i] != str[length - i - 1]) {
            isPalindrome = 0;
            break;
        }
    }
    if(isPalindrome)
        printf("Palindrome\n");
    else
        printf("Not a Palindrome\n");
    return 0;
}

 

< longest word in a string Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top