answersLogoWhite

0

Wap to display palindrome no in c?

User Avatar

Anonymous

15y ago
Updated: 8/18/2019

#include<stdio.h>

#include<conio.h>

#include<string.h>

main()

{

char str[20],revstr[20];

int i,j=0,l,n;

printf("enter a string");

scanf("%s",str);

l=strlen(str);

n=l-1;

for(i=n;i>=0;i--)

{

revstr[j]=str[i];

j++;

}

revstr[j]='\0';

if((strcmp(str,revstr))==0)

printf("palindrome");

else

printf("not a palindrome");

getch();

}

User Avatar

Wiki User

15y ago

What else can I help you with?