Preventing decimal answer in division questions

Preventing decimal answer in division questions

by Ian Gladden -
Number of replies: 3

Following on from my previous issue which was successfully answered I'm now trying to make some simple calculated division questions, the issue I'm having is that I want to ramp the difficulty up as the students go through the numeracy test but I need it to start simple, which means integer only answers to start.


Is there any way to force this?

Average of ratings: -
In reply to Ian Gladden

Re: Preventing decimal answer in division questions

by Pierre Pichet -

The same way you use in your other quiz issue (https://moodle.org/mod/forum/discuss.php?d=275379)  i.e. if what you divide if the product of 2 integers and your divisor is one of these integers then the result will be an integer

i.e  {a}=6*{b}=5 will give an integer 30 that can be divided by either {a}=6  or {b}=5.

So write in the question text

What is the result of {={a}*{b}} divided by {a} ?

and in answer formula {b}*({a}/{a})

Generate the values with 0 decimals,


Average of ratings: Useful (1)
In reply to Pierre Pichet

Re: Preventing decimal answer in division questions

by Ian Gladden -

Once again, thanks very much for your assistance, you're making it easy for a relatively new user to get started.

In reply to Ian Gladden

Re: Preventing decimal answer in division questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It is a common thing with randomly generating maths problems, it is almost always easier to randomly generate the answer, and then work back from that to get the question.

Average of ratings: Useful (1)