C Program For String Palindrome
Get Certified in C Programming and Take Your Skills to the Next Level
Program 1
// Program for string palindrome without using inbuild function
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char s[100];
int i,j,f=0;
printf("Enter a string: ");
gets(s);
i=0;
j=strlen(s)-1;
while(i<=j)
{
if(s[i]!=s[j])
{
f=1;
break;
}
i++;
j--;
}
if(f==0)
printf("String is palindrome");
else
printf("String is not palindrome");
// strcpy(s1,s);
// //puts(s);
// strrev(s1);
// x=strcmp(s,s1);
// if(x==0)
// printf("String is palindrome");
// else
// printf("String is not palindrome");
return 0;
}
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

