fork download
  1. #include <stdio.h>
  2.  
  3. int somault(int n, int original){
  4. if(n < 10) return n + original;
  5. return somault(n/10, original);
  6. }
  7.  
  8. int main() {
  9. int n;
  10. scanf("%d", &n);
  11. printf("%d", somault(n, n));
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 9424KB
stdin
54321
stdout
54326