 C Tutorial

# C Program to Check Number is a Polindrome or Not

## C Program To Check Number is a Polindrome or Not

This c program is used to find the number is a polindrome or not.

## Polindrome Number Algorithm:

```1) Find reversal number for the number.
2) Number is a polindrome if number and reversal number are same, otherwise number is not a polindrome.
```

## Check Number is a Polindrome or Not

```#include<stdio.h>

void main()
{
int number, dup_number, remainder, reverse_number = 0;

printf("Enter number: ");
scanf("%d", &number);

dup_number = number;
while(dup_number < 0)
{
remainder = dup_number % 10;
reverse_number = (reverse_number * 10) + remainder;
dup_number /= 10;
}

if (number == reverse_number)
printf("Number '%d' is a palindrome.", number);
else
printf("Number '%d' is not a palindrome.", number);
}
```
Output:
```\$ cc polindrome-number.c
\$ ./a.out
Enter number: 2345432
Number '2345432' is a palindrome.
\$ ./a.out
Enter number: 3242
Number '3242' is not a palindrome.
``` C Tutorial

## C Examples

Privacy Policy  |  Copyright 2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page     