Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Codeoftheday.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>
#include <string.h>
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(;i<halfword && j>halfword;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;
}