C Program to find palindrome

C Program to find palindrome

A number is said to be Palindrome number if it remains the same after reversing the number. Ex: 121, 34543, 343, 131, 48984 are the palindrome numbers. Through this logic, we create a program to determine whether a given number is a palindrome or not. Once this program is successfully compiled, it will get input from the user and check whether the number is a palindrome or not.

	Check if the Number is Palindrome
	Author 			: 		Krishna Teja G S
	Repository		:		github.com/packetprep/coding-questions
	Website			: 		packetprep.com


int main(){

	int number,lastDigit,originalNumber,reverseNumber=0;

	printf("Enter a positive integer: ");

	originalNumber = number;

	// An integer is a palindrome if the reverse of that number is equal to the original number.
	//reverse the number
		//get the last digit
		lastDigit = number % 10;

		reverseNumber = reverseNumber*10 + lastDigit;

		//remove the last digit
		number = number/10;

	if(originalNumber == reverseNumber)
		printf("The given number is a Palindrome\n");
		printf("The given number is not a Palindrome \n");