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.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
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