C Programming Code Examples C > Mathematics Code Examples Program to Reverse a Number & Check if it is a Palindrome Program to Reverse a Number & Check if it is a Palindrome This C program accepts an integer, reverse it and also checks if it is a palindrome or not. - Take the number which you have to reverse as the input. - Obtain its quotient and remainder. - Multiply the separate variable with 10 and add the obtained remainder to it. - Do step 2 again for the quotient and step 3 for the remainder obtained in step 4. - Repeat the process until quotient becomes zero. - When it becomes zero, check if the reversed number is equal to original number or not. - Print the output and exit. #include <stdio.h> void main() { int j, temp, remainder, reverse = 0; printf("Enter an integer \n"); scanf("%d", &j); /* original number is stored at temp */ temp = j; while (j > 0) { remainder = j % 10; reverse = reverse * 10 + remainder; j /= 10; } printf("Given number is = %d\n", temp); printf("Its reverse is = %d\n", reverse); if (temp == reverse) printf("Number is a palindrome \n"); else printf("Number is not a palindrome \n"); }