ProAnswers.org

Write a C program to find out the Palindrome without using String Function?

#include

#include 

void main() 

{ 

char str[20]; 

int i,j,flag=0; 

clrscr(); 

printf(“enter a string:

”);

scanf(“%s”,str); 

i=o; 

while(str[i]!=‟10‟) 

i++; 

j=j-1; 

for(i=0;i<=j;i++,j--) 

{ 

if(str[i]!=str[j]) 

{ 

flag=1 

break; 

} 

} 

if flag==0 

printf(“it is palindrome”); 

else 

printf(“it is not a palindrome”); 

getch(); 

} 

Output: 

enter a string: 

malayalam 

it is palindrome