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

Friday 5 July 2013

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

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("\nString is Palindrome");
    else
        printf("\nString 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 I am sorry if this program in your point of view is too long. "

Popular Posts