Skip to main content
added 6 characters in body
Source Link
gastropner
  • 4.4k
  • 1
  • 15
  • 20

C (gcc), 7777 75 bytes

Has to be compiled with the -lm switch or GCC doesn't recognize the math functions.

r,q,i;f(n){for(r=0,i=n;i;i/=10)q=(log10q=log10(n)+1)-i%10,r+=n/pow(10,q>0?q:0);n=r;}

Try it online!Try it online!

C (gcc), 77 bytes

Has to be compiled with the -lm switch or GCC doesn't recognize the math functions.

r,q,i;f(n){for(r=0,i=n;i;i/=10)q=(log10(n)+1)-i%10,r+=n/pow(10,q>0?q:0);n=r;}

Try it online!

C (gcc), 77 75 bytes

Has to be compiled with the -lm switch or GCC doesn't recognize the math functions.

r,q,i;f(n){for(r=0,i=n;i;i/=10)q=log10(n)+1-i%10,r+=n/pow(10,q>0?q:0);n=r;}

Try it online!

Source Link
gastropner
  • 4.4k
  • 1
  • 15
  • 20

C (gcc), 77 bytes

Has to be compiled with the -lm switch or GCC doesn't recognize the math functions.

r,q,i;f(n){for(r=0,i=n;i;i/=10)q=(log10(n)+1)-i%10,r+=n/pow(10,q>0?q:0);n=r;}

Try it online!