The assignment that I need help with requires us to make a program that takes the units of a positive integer and adds them all up. For example if the user enters in the number 15 the result you should get is 6. The one part of the program that i managed to get working is the part that checks if the number entered in is positive or not. What makes this more challenging is how we are not allowed to use blocks that are related to list like split or block that are related to string like letter. In the assignment details it also says the best way to solve this problem is through the use of the mod block. Can anyone help me?
Do you mean digits?
yeah thats what i meant to say
So, the point of all those restrictions is that your teacher wants you to think about the number as a number, not as text.
Do you understand what MOD does? Can you use to find a single digit of the number? What would go where the
Just so you know, there's kind of a rule on the forum that says we don't do your homework for you, but we can help guide you in the right direction, which means I can help you, but not give you the solution.
I'm wondering, how good are you at math? I'm only asking because I found a great wikipedia article about digit sum.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.