Write a program to check palindrome number in C Programming?

#include
#include
main()
{
int n,r,sum=0,temp;
clrscr();
printf(“enter the number=”);
scanf(“%d”,&n);
temp=n;
while(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
printf(“palindrome number “);
else
printf(“not palindrome”);
getch();
}

Certainly! Below is a C program to check if a given number is a palindrome or not:

c
#include <stdio.h>

int main() {
int n, reversedN = 0, remainder, originalN;

printf("Enter an integer: ");
scanf("%d", &n);

originalN = n;

// reversedN stores the reverse of n
while (n != 0) {
remainder = n % 10;
reversedN = reversedN * 10 + remainder;
n /= 10;
}

// palindrome if originalN and reversedN are equal
if (originalN == reversedN)
printf("%d is a palindrome.\n", originalN);
else
printf("%d is not a palindrome.\n", originalN);

return 0;
}

This program takes an integer input from the user, stores it in n, then calculates the reverse of that number (reversedN) by continuously dividing the number by 10 and accumulating the remainder. Finally, it checks whether the original number (originalN) is equal to its reverse (reversedN), and prints whether it’s a palindrome or not.