diff --git a/Codeoftheday.c b/Codeoftheday.c new file mode 100644 index 0000000..e38baf9 --- /dev/null +++ b/Codeoftheday.c @@ -0,0 +1,22 @@ +#include +#include +int main() +{ +char word[100]; +printf("Enter the word to be checked : "); +scanf("%s",word); +//checking if the input is a palindrome +int i=0,j=strlen(word)-1; +int halfword=strlen(word)/2; +for(;ihalfword;i++,j--) +{ +if(word[i]!=word[j]) +{ +printf(" The string ' %s ' is not a palindrome ",word); +break; +} +} +if(i==halfword && j==halfword) +printf("The string %s is a palindrome",word); +returnĀ 0; +}