Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $35$


Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $ 35$ .

My try:

1) Start

2) $ N\leftarrow 0$

3) $ S \leftarrow 0$

4) $ R \leftarrow N-10\lfloor\frac{n}{10}\rfloor$

5) $ S \leftarrow R+S$

6) $ N\leftarrow\lfloor\frac{n}{10}\rfloor$

7) If $ N>0$ , go to $ 4$ , otherwise print $ S$

8) If $ S\le35$ then $ N\leftarrow N+1$ , otherwise print $ N$

9) end


I’m not sure if this algorithm works,so can someone please check that? plus does there exist any algorithm that determines the numbers such that the sum of their digits is greater than $ 35$ , besides determines how many such numbers exist? (I think they are infinity many such numbers)