Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday, December 20, 2014

Program to find given number is palindrome number or not by do while loop in C.


Palindrome number checker in C


Code Box
---------------------------------------------

/*Program to find given number is palindrome number or not by do while loop in C*/

#include<stdio.h>
#include<conio.h>

void main()
{
int num,num1,rem,newnum;
clrscr();

newnum=0;
printf("\n\tPalindrome Number Checker ");
printf("\n-------------------------");
printf("\nEnter a number:");
scanf("%d",&num);

num1=num; //to save actual number
do
{
rem=num1%10;
num1=num1/10;
newnum=newnum*10+rem;
}while(num1>=1);

if(num==newnum)
{
printf("\nNumber %d is palindrome number ",num);
}
else
{
printf("\nNumber %d is not a palindrome number ",num);
}

getch();

}

No comments: