fork download
  1. #include <stdio.h>
  2.  
  3. int test(int x) {
  4. int i = 0;
  5.  
  6. while (x) {
  7. i = i * 10 + x % 10;
  8. x /= 10;
  9. continue;
  10. }
  11. return i;
  12. }
  13.  
  14. int main(void) {
  15. printf("%d %d %d\n", test(8505), test(1000), test(123));
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
5058 1 321