Write a c program to read a string and check whether it is palindrome or not

#include<stdio.h>
#include<string.h>
void main() {
    char s[50];
    int i,flag=1;
    printf("Enter string: ");
    scanf("%s",s);
    for(i=0;i<strlen(s)/2;i++)
        if(s[i]!=s[strlen(s)-1-i]) flag=0;
    printf(flag ? "Palindrome" : "Not Palindrome");
}