Pattern Codes, ABCDE Code, Arduino Code

Sunday 15 January 2017

Palindrome number

To check number is palindrome or not

Output:

 Enter the number to check whether it is palindrome or not12321


 Number is palindrome 12321 = 12321

Code:

#include<stdio.h>

int main()
{
int rem,div,n,temp,sum =0;
printf("\n Enter the number to check whether it is palindrome or not");
scanf("%d",&n);
temp = n;
while(n!=0)
{
rem = n%10;
div = n/10;
sum = sum*10 + rem;
n = div;
}
if(sum == temp)
{
printf("\n Number is palindrome %d = %d ",temp,sum);
}
else
{
printf("\n Number is not palindrome %d != %d",temp,sum);
}
}

1 comment :

Rolls Royce

Rolls Royce
Amazing Cars

About Me