Search



Thursday, 26 February 2015

Palindrome number

In this program, we'll check whether the input number is Palindrome or not, While loop and if else functions will be used. palindrome no.s are the ones which when reversed gives back the same no. For eg:-25852 iss a palindrome no.

Program of Palindrome number.

#include <stdio.h>
#include<conio.h>
void main()
{ int n,rev=0,rem,temp;
clrscr();
printf("\n\n program to chcek whether input no. is palindrome");
printf("\n Enter an integer: ");
scanf("%d", &n);
temp=n;
while(temp!=0)
{ rem = temp%10;
rev = (rev * 10) + rem;
temp = temp/10;
}
if(rev==n)
printf("\n %d is a palindrome.",n);
else printf("\n %d is not a palindrome.",n);
getch();
}


No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.