Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

string palindrome in c

0 votes
asked Aug 29, 2018 by Shubham das (120 points)

2 Answers

0 votes
answered Aug 29, 2018 by Cheeku
#include<stdio.h>

#include<string.h>

main()

{

int i, j=0;

char a[100],p[100]={0};

printf("ENTER");

gets(a);

for(i=strlen(a)-1;i>=0;i--)

{

a[j]=b[i];

j++;

}

b[j]='\0';

printf("reverse%s",b);

if(strcmp(a,b)==0)

{

printf('palindrome");

{

else

{

printf("not");

}

}
0 votes
answered Aug 30, 2018 by Ravi Kumar (140 points)
#include<stdio.h>
int main()
{
    char s[100];
    int len,i,flag=0;
    printf("Enter string:\n");
    scanf("%s",s);
    len=strlen(s);
    for(i=0;i<=len;i++)
    {
        if(s[i]!=s[len-1-i])
        {
            flag=1;
            break;
        }
    }
    if(flag==0)
    printf("Palindrome");
    else
    printf("Not a palindrome");
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...