Sun May 27 2018

Palindrome Number

C Programming869 views

File Name: palindrome-number.c

#include<stdio.h>

int main() {
	int no, temp, palindrome = 0;
	printf("Check the given number is Palindrome or not\n");
	printf("Enter a Number:\n");
	scanf("%d", &no);
	temp = no;

	/* Loop the process using "While loop" */
	while(no != 0) {
		palindrome = palindrome * 10;
		palindrome = palindrome + (no % 10);
		no = no / 10;
	}
	if(temp == palindrome)
		printf("It's a Palindrome Number!\n");
	else
		printf("It's not a Palindrome Number!\n");
	return 0;
}



/* Output */
Check the given number is Palindrome or not
Enter a number:
121

It's a Palindrome Number!

/* ---------------------------------- */

Check the given number is Palindrome or not
Enter a number:
128

It's not a Palindrome Number!

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.