fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<limits.h>
  4. unsigned int reversePrint(unsigned int x);
  5. int main(){
  6.  
  7. unsigned int a = UINT_MAX;
  8. printf("int max is %u\n", a);
  9.  
  10. unsigned int x =0;
  11. while(scanf("%u",&x) != EOF){
  12. unsigned int y = reversePrint(x);
  13.  
  14. if( y < 0xffffffff ){
  15. printf("%u\n",y);
  16. }else{
  17. printf("out of range of unsigned int");
  18. }
  19. }
  20. }
  21.  
  22. unsigned int reversePrint(unsigned int x){
  23. unsigned int j =10;
  24. if(x<j) return x;
  25. else{
  26. printf("%u", x%j);
  27. x = x /j;
  28. return reversePrint( x );
  29. }
  30. }
Success #stdin #stdout 0s 9432KB
stdin
123
stdout
int max is 4294967295
321