Program for Number Palindrome in C

Here you will get program for number palindrome in C.

A number is palindrome if it is equal to its reverse.

For example 121, 111, 1331 are palindrome numbers.

Program for Number Palindrome in C

#include<stdio.h>

int main()
{
	int n,a,b=0,num;
	printf("Enter any number:");
	scanf("%d",&n);
	num=n;
	
	while(n!=0)
	{
		a=n%10;
		b=a+(b*10);
		n=n/10;
	}
	
	if(num==b)
		printf("\nThe given number is palindrome");
	else
		printf("\nThe given number is not palindrome");

	return 0;
}

 

Output

Enter any number:12321

The given number is palindrome

2 thoughts on “Program for Number Palindrome in C”

  1. Hey how can you take an input as integer and show it as a palindrome in a char arrya as “123321” for the input 123

  2. i want to usse one program if else ladder and we use palindrome and Armstrong both. we give a value. on run time a we got this no is palliondrome or amrstrong or both not

Leave a Comment

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