As part of the random number generator subroutine,  why not print the

returned values & ask your student if A/B is a valid operation?



On 9/20/17, Roger Mullins <[email protected]> wrote:
> LOL it happens I guess; I'm close to that many years removed from having to
> deal with most of this stuff myself.
>
> Anyhow, I don't think I described my predicament as clearly as I should
> have.  My focus is less on having the computer do the math (although it has
> to in order to check the answer given), and more on not presenting an
> unnecessarily difficult problem to the kiddo.  Here's the general idea.
>
> 1) GOSUB to send back two random integers, A and B
> 2) Print 'What is A divided by B?'
> 3) Input quotient (C)
> 4) Input remainder (D)
> 5) GOSUB to check the answers - correct if C = A\B and D=(A mod B)
>
> What I'm trying to figure out is where to insert the test between steps 1
> and 2 to make sure that the program doesn't spit out "What is 5 divided by
> 12" or "What is 8 divided by 0".
>
> On Wed, Sep 20, 2017 at 11:35 AM, John Gardner <[email protected]> wrote:
>
>> Yep,  I screwed it up - The Remainder is what's left of the Dividend.
>>
>> Anyway,  have fun - My 9-year-old daughter is nearly 40. Good times...
>>
>> On 9/20/17, John Gardner <[email protected]> wrote:
>> > Or simply subtract the Divisor from the Dividend until the Dividend
>> >
>> > <remaining> is less than the Divisor - The index of the loop is the
>> >
>> > Quotient,  & the Remainder is what's left of the Quotient.
>> >
>> > I hope I did'nt screw that up - 3rd grade was about 60 years ago...
>> >
>> >    :)
>> >
>> > On 9/20/17, John R. Hogerhuis <[email protected]> wrote:
>> >> I guess for division your random numbers are the divisor and the
>> >> result
>> >> of
>> >> the division.
>> >>
>> >> Multiply them together to get what you are to divide.
>> >>
>> >> -- John.
>> >>
>> >
>>
>

Reply via email to