Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  c prog
Language: C/C++
Code:
#include <stdio.h>
#include<string.h>
int palindrome_test(char*);
int main()
{ char a[30];int p;
     printf("Enter a String");gets(a);
p=palindrome_test(a);
if(p==1) printf("The given string is palindrome");
else print("The given string is not palindrome");
return 0;}
int palindrome_test(char a[])
{
int m,i,l=0,flag=1;
for(i=0;a[i]!='/0',i++)
l++;
l--;
m=l/2;
for(i=0;i<=m-1;i++,l--)
{
if(a[i]!=a[i])
{
flag=0;break;}
}
if(flag==1)
return 1;
else
return 0;}
          
Comments: