fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int num,temp,rem,reverse=0,count=0;
  5. printf("Enter n : ");
  6. scanf("%d",&num);
  7. temp=num;
  8. while(temp!=0){
  9. rem=temp%10;
  10. reverse=reverse*10+rem;
  11. temp=temp/10;
  12. count++;
  13. }
  14. printf("number of digits : %d\n",count);
  15. if(reverse==num)
  16. printf("palindrome");
  17. else
  18. printf("not palindrome");
  19.  
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Enter n : number of digits : 5
not palindrome