# [C (gcc)], 77 bytes

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

<!-- language-all: lang-c -->

    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!][TIO-je1c465t]

[C (gcc)]: https://gcc.gnu.org/
[TIO-je1c465t]: https://tio.run/##Nc1BCoMwEAXQdXOKIAgJRsxo3TTEXqQbUQwBnWha2oV49aaxtav/4H9mutx0XQheLMKqgSFfB@eZ11JYjcoqW2iQfNFsdAZk7DPguU1BCp9pLGb3YtFLI6/LRXKF2qstPJ3tqWEWHxQ5Wclp9tEDS9Ke6oam/Q0TQVHQ/SFXZCNk306tRfbdGxZv7VEeUUH9E1QlnP@UcNT1ji28u2FszT3k4/QB "C (gcc) – Try It Online"