Math, asked by chantallcarillo, 2 months ago

what is the algorithm of 1234

Answers

Answered by vidhansingh58
0

Answer:

Input: 1234

* Divide the number by 10

So, we now have 123.

That removed the last digit for us.

We now need to make sure our number is greater than or equal to 10, and keep on adding together the next digits.

Get the next digit with: myNum % 10

Steps:

1234 / 10 = 123.

123 > 10, so we keep going.

123 % 10 = 3.

123 / 10 = 12.

12 > 10, so we keep going.

12 % 10 = 2.

12 / 10 = 2.

2 < 10, therefore we are finished.

3 + 2 was 5.

Similar questions