Quote:
Originally Posted by CaptSamuelFrank This is from the first day of class. We were given problems we should be able to do. The only one I had a problem with was this one as I have never really learned any programming yet nor modulus's.
If someone could show me the steps to solving this problem and explain how to go about solving it I would be very pleased. I wish to be able to do these kind of things on my own and I am guessing it is probably quite simple |
I will tell you that I do not know anything past a basic knowledge of programming.
But I am sure that the second line is incorrect. It must be
While a >1.
Otherwise, we are in an infinite loop.
If that correction is made, then the program adds then the digits in the number
a.
So that is the answer to part a.
For part (b), the number pf ‘sums’ is the number of places in the number a.