Tuesday, February 27, 2018

Palindrome Checker in C

Here is a simple program that will ask the user to give a string and our program will check if the given string is a Palindrome or not Palindrome using C language.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

palindrome.c

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

int main()
{
   char str_name[100], b[100];

   printf("PALINDROME CHECKER IN C ");
   printf("\n\n");
   printf("Give a String : ");
   gets(str_name);

   strcpy(b,str_name);
   strrev(b);

   if (strcmp(str_name,b) == 0) {
      printf("\n\n");
      printf("The given string %s is a palindrome.\n",str_name);
      }
   else{
       printf("\n\n");
       printf("The given string %s is not a palindrome.\n",str_name);
       }
   return 0;
}




No comments:

Post a Comment