Palindrome number C program

It’s a Palindrome number C program that inputs any number from the user, then use Palindrome number condition to check entered number Palindrome or not, and print result on the screen.

To understand this program, it’s better you should know the following topics:

Program (1): to check number is palindrome or not.

#include<stdio.h>
#include<conio.h>
void main()
{
int digit,num,orgnl;
int reverse=0;
printf("Enter the number : ");
scanf("%d", &num);
orgnl = num;
while(num > 0)
{
digit=num % 10;
reverse = reverse*10 + digit;
num=num / 10;
}
if(orgnl == reverse)
printf("Number %d is palindrome", orgnl);
else
printf("Number %d is not palindrome", orgnl);
getch();
}

Output (1)

Enter the number : 141
Number 141 is palindrome

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *