Write a C Program to check whether a number is palindrome or not. In this program, we take an input number from a user and check whether an input number is palindrome or not.

A palindrome number is a number that remains same when it's digits are reversed.

For example - 11, 22, 121, 12321, 16461 etc.

C program to check whether a number is Armstrong or not

i) Take an input number from a user.

ii) Reverse an input number.

iii) Compare input number and reverse of an input number. If both are equal then entered number is a palindrome number.

C program to check whether a string is palindrome or not

### What is a Palindrome Number?

A palindrome number is a number that remains same when it's digits are reversed.

For example - 11, 22, 121, 12321, 16461 etc.

C program to check whether a number is Armstrong or not

### How to check whether a number is palindrome or not?

ii) Reverse an input number.

iii) Compare input number and reverse of an input number. If both are equal then entered number is a palindrome number.

C program to check whether a string is palindrome or not

## C Program to Check Whether a Number is Palindrome or Not

In this programming example, first step is to take an input from a user then find the reverse of an input number. If input number and reverse of an input number is same then it's a palindrome number.

#include<stdio.h> int main(){ int num, temp, rev, digit; //Input number printf("Enter a number \n"); scanf("%d", &num); temp = num; //Reverse a number while( temp > 0) { digit = temp % 10; rev = rev * 10 + digit; temp = temp / 10; } /* If original number and reverse of a number is same, then it's palindrome */ if( num == rev) { printf(" %d is a Palindrome number", num); } else { printf(" %d is not a Palindrome number", num); } return 0; }

Output -

Enter a number: 121

121 is a palindrome number

C program to print fibonacci series using recursion

C program to reverse a number

C interview questions for practice

C program to calculate power of a number

## 0 comments:

## Post a Comment