#include <stdio.h>
#include <stdlib.h>

void main()
char x[10],y[10];
int i,j,k,flag=0;
printf("enter the string: ");
        printf("the string is palindrome");
        printf("not palindrome");

Edited 4 Years Ago by rithish

it is sizeof() operator, not sizof. spelling error. check it now.

try to check the beginning and end of the indeces of the string if equal. The index starting from the beginning to increment and the index starting at the end to decrement and comparing both of them

       //here int i is the counter of the index from the start of the word and j from the end and n as the counter to check if the word is a palindrome
       j = strlen(string) - 1;
       for(i = 0; i <= j ; i++,j--){                   
               n=1; //counter tells that the sting is currently not a palindrome                                 
               break;  //once found that character doesn't matches it breaks from the loop                             
               n=0; //counter tells that the sting is currently a palindrome                                

then print the word is not a palindrome if the value of n is 1 else a palindrome

Edited 4 Years Ago by zeroliken

This question has already been answered. Start a new discussion instead.