Posts

Showing posts with the label Q.Write a program to find palindrome string using string functions.

Q.Write a program to find palindrome string using string functions.

Image
Program: #include < stdio.h > #include < conio.h > #include < string.h > void main() {     char a[30];     int b,c=0,i=0,j;     clrscr();     printf (" Enter the String: ");     scanf ("%s",a);     b=strlen(a);     j=b-1;     while (a[i]==a[j])     {         ++c;         ++i;         --j;     }      if (c==b)          printf ("\n String is Palindrome ");     else         printf ("\n String is not a palindrome ");     getch() ; } Sample Output:      Note:     " Hi I am a Learner of C/C++. I have done this program with my own Knowledge. There may be an easy way to solve this program. So ...