From e24f4715e79e72fa0999fe300dc6ef2a7982d9d2 Mon Sep 17 00:00:00 2001 From: Electron-hack <97846362+Electron-hack@users.noreply.github.com> Date: Mon, 24 Oct 2022 17:59:03 +0530 Subject: [PATCH] Create Codeoftheday.c --- Codeoftheday.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Codeoftheday.c 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; +}