The Big Billion Days is Back On Flipkart


Latest
Check re Check the recent posts below

Follow by Email

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. "

No comments:

Post a Comment

Hello Friends...! Lets share Your Views,Ideas,Comments here....!!

Follow by Email

Popular Posts

Created by FOREVER FRIENDS