Tuesday, 27 December 2016

C PROGRAMMING PROJECT 3

  PALINDROME WITHOUT USE OF INBUILT FUNCTION


#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
    char a[25];
    int i=0,j,c;
    printf("\n enter the string\n");
    gets(a);
    while(a[i]!='\0')
    {
        i++;

    }
    for(j=0;j<i-1;j++)
    {
        if(a[j]==a[(i-1)-j])
            c=0;
        else
            c=1;

    }
    if(c==0)
    {
    printf(" entered string is palindrome");
    }
    if(c==1)
    {
    printf(" entered string is not palindrome");
    }
getch();

}

No comments:

Post a Comment