I am a beginner in C programming.
I coded finding whether a number is palindrome or not.
It is not working, so anybody help me
#include<stdio.h>
int sum=0,n,r;
int reverse(int x);
int main(){
printf("the number you want to check whether it is palindrome or not ");
scanf("%d",&n);
reverse(n);
if (sum==n)
{
printf("congratulations you got your palindrome number\n");
}
else{
printf("sorry it is not palindrome number\n");
}
return 0;
}
int reverse(int x){
while (n>0)
{
r=n%10;
sum=sum*10+r;
n=n/10;
}
return sum;
}