fork download
  1. #include<stdio.h>
  2. int main () {
  3. int num,rem,temp,sum=0,rev=0;
  4. printf("Enter a number:");
  5. scanf("%d",&num);
  6. temp=num;
  7. while(num>0){
  8. rem=num%10;
  9. rev=rev*10+rem;
  10. sum=sum+rem;
  11. num=num/10;
  12. }
  13. printf("The sum of digits of %d = %d",temp,sum);
  14. if(temp==rev){
  15. printf("%d is a palindrome number",temp);
  16. }
  17. else{
  18. printf("%d is not a palindrome number",temp);
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 5312KB
stdin
123
stdout
Enter a number:The sum of digits of 123 = 6123 is not a palindrome number