The TransCompilator

Solved LeetCode program · 202 of 1,000

#0233 · Number of Digit One

Hard Math chunk-05.md

Original English source

The limit is 13. Keep a shared total of 0.
For every number from 1 to limit.
The value is number.
Repeat while value is more than 0.
The digit is value modulo 10. If digit is 1, add 1 to total. Set value to value divided by 10.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

6