Palindrome Number solution using c language programming info problem 17

Palindrome Number




  1. #include<stdio.h>  
  2. int main()    
  3. {    
  4. int n,r,sum=0,temp;    
  5. printf("enter the number=");    
  6. scanf("%d",&n);    
  7. temp=n;    
  8. while(n>0)    
  9. {    
  10. r=n%10;    
  11. sum=(sum*10)+r;    
  12. n=n/10;    
  13. }    
  14. if(temp==sum)    
  15. printf("palindrome number ");    
  16. else    
  17. printf("not palindrome");   
  18. return 0;  
  19. }  


Output:
enter the number=151
palindrome  number

enter the number=5621
not palindrome  number
Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support