Breaking News

C program to check whether given String is Palindrome or not using Library Functions

 A string is called a palindrome when on reversing it, we get the same original string.This C program checks whether the entered string is palindrome or not using library functions.For these purpose a header file String.h has been included in the program which contains strcpy( ),strrev (),strcmp( ) and  various other string manipulating methods
The string is input by the user using gets(). Using gets() allows the compiler to input the spaces of string also. The length of string is calculated using library functions and the result is printed on compiler screen using printf.

Source Code-


#include
#include
int main()
{
   char a[100],b[100];
   printf("Enter your String : ");
   gets(a);
   strcpy(b,a);
   strrev(a);
   if(strcmp(a,b)==0)
    printf("The Given String is a palindrome");
   else
    printf("The given String is not a palindrome");
return 0;
}



Output-

No comments

shankhajana. Powered by Blogger.