Write a c program to check palindrome number

Ram Pothuraju

 #include <stdio.h>

int main()


    int n, reversedN = 0, remainder, originalN;

    printf("Enter an integer: ");

    scanf("%d", &n);

    originalN = n;

    // Reversing the number

    while (n != 0)


        remainder = n % 10;

        reversedN = reversedN * 10 + remainder;

        n /= 10;


    // Checking if the reversed number is equal to the original number

    if (originalN == reversedN)


        printf("%d is a palindrome number.", originalN);




        printf("%d is not a palindrome number.", originalN);


    return 0;


In this program, we first take an integer as input from the user. We store the original number in a separate variable for later comparison. Then, we loop through the digits of the number and reverse the number. Finally, we compare the reversed number with the original number and print the appropriate message to indicate whether the number is a palindrome or not.

Post a Comment


Post a Comment (0)