Palindrome Program in C Language

Check the Given Number / String is Palindrome or Not using C program / Code


The is common program will be asked to write program for Palindrome in C or to Check the Given String string is palindrome or not, or to check the given number is palindrome or not. As we know if the Given string and reversed string are same then the String or number is a palindrome number eg: 121, madam, malayalam, liril so on. These string can't change after you reverse it. So we can say these are the palindrome. Here I write a C Program to check whether the given input is palindrome or not. Here the example code / program.

//C Source code for palindrome
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[20];
int i,j,l;
clrscr();
printf("Enter name\n");
gets(s);
l=strlen(s);//Length of a String
for (i=0,j=l-1;i<j;i++,j--)
{
if (s[i]!=s[j])
{
printf("\n The given input is not a Palindrome");
break;
}
else
printf("\n The Given Input is Palindrome");
}
getch();
}


Related Topic The List of Basic Windows 7 Keyboard Shortcut Keys
How to Include PHP in HTML File page
Java Enum Example
How to Add Multi Language Support in Java
List of Server Ports and their Assigned Numbers

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback