Calculating Remainder

Aug 19, 2014

Does anyone know of a way to calculate the remainder on a division question?

I want to figure out a way so that storyline will show 7 / 2 = 3 with a remainder of 1.

9 Replies
Michael Hinze

You could try a JavaScript that uses the remainder ("%") operator. Something like:

var player = GetPlayer();
var JSValue1 = player.GetVar("Value1");
var JSValue2 = player.GetVar("Value2");
var JSResultTemp = JSValue1 / JSValue2
var JSResult = Math.floor(JSResultTemp);
var JSRemainder = JSValue1 % JSValue2;
player.SetVar("Result",JSResult);
player.SetVar("Remainder",JSRemainder);

OWEN HOLT

Interested in a non java solution?

As long as your numerator is greater than your denominator....

Variables required: Numerator, Denominator, Answer, CalculateRemainder, Remainder.

Set your Answer = to the denominator

Subtract 0.49 from the Answer

divide your Answer by 10000000

multiply your Answer by 10000000

This gives you the whole number portion of your solution stored in the variable Ă„nswer".

Set an additional variable (I called mine CalculateRemainder) = to your Denominator

multiply this by your Answer.

Set your Remainder = to the Numerator

Subtract your additional variable from your remainder.

This gives you the remainder portion of your solution stored in a variable called Remainder.

This discussion is closed. You can start a new discussion or contact Articulate Support.