C Program to check a number is Palindrome or not.

If you have just started learning C programming and want to write a C Program of Palindrome number.
We have come up with the solution to your problems.
If you do not know how to write a simple program in C Language then you must read: Introduction to C language and learn the program structure here Structure of C program.
After learning the basic concept make two or three basic programs and then try this program.
What is a Palindrome number?
A Palindrome number is a special type of number in which the reverse of the number is equal to the number itself.
For Example – 121 is a palindrome number because reverse of number will be equal to the number itself.
C Program of Palindrome number –
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include <stdio.h> int main() { int Original_number, result = 0, temp; printf("Enter a number to check if it's a palindrome or not"); scanf("%d", &Original_number); temp = Original_number; while (temp != 0) { result = result * 10; result = result + temp%10; temp = temp/10; } if (Original_number== result) printf("%d is a palindrome number.\n", Original_number); else printf("%d isn't a palindrome number.\n", Original_number); return 0; } |
Output of Program – Enter a number to check if it’s a palindrome or not 343 343 is a palindrome number.
Advantages of Palindrome Number Program
- Palindrome number program is one of the most asked programming questions in the technical interviews of many major IT Companies.
- In your College/University exams you can get this question many times. So, it will increase your marks.
- After doing this program, you will learn how we can separate digits from the number.
- This program will help you in solving many other major problems.
For running the program online, check this online compiler.
Frequently Asked Questions –
Yes, the program is very important from placement as well as the point of an exam of view.
Yes, the speed of the program will decrease only.
212, 343,5445 all are palindrome numbers.