Wiris

Documentation / Nubric

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • WirisQuizzes

      • Nubric

        • CalcMe

          • MathPlayer

            • Store FAQ

              • MathFlow

                • BF FAQ

                  • Miscellaneous

                    • Wiris Integrations

                      • Home
                      • Nubric
                      • Using Nubric
                      • Advanced Logic in Nubric
                      • Advanced Logic Examples in Nubric
                      • Advanced Logic Examples in Nubric

                      How to generate a division with no remainder (exact division)

                      Reading time: 1min

                      Use this method when you want students to perform a division and ensure that the result is always an exact integer (no decimals or remainders).

                      Following this guide, you will generate two integers (dividend and divisor) such that the division always produces a whole number result.

                      See it in action: Watch how this logic is implemented inside Nubric:

                      Your browser does not support HTML5 video.

                      Before you begin

                      Requirements

                      • Basic knowledge of how to create a Nubric question
                      • Familiarity with adding an algorithm to generate random variables

                      Steps

                      Select a divisor

                      div = random(2,12)

                      This defines the divisor and avoids trivial cases like division by 1.

                      Select a quotient

                      quot = random(2,10)

                      This defines the exact integer result students should obtain.

                      Compute the dividend

                      dividend = div * quot

                      Multiplying the divisor and quotient yields a dividend that guarantees exact division.

                      Define the solution

                      solution = quot

                      This value can be used directly for grading.

                      Verify it worked

                      • Preview the question multiple times.
                      • Divide the generated dividend by the divisor manually.
                      • Confirm that the result is always an integer.
                      • Ensure no decimal answers appear.

                      Full algorithm (copy-paste version)

                      Use the complete version below if you want to copy the logic directly into your question algorithm:

                      # Select a random divisor from 2 to 12
                      div = random(2,12)
                      
                      # Choose a random integer quotient between 2 and 10
                      quot = random(2,10)
                      
                      # Compute dividend ensuring exact division
                      dividend = div * quot
                      
                      # Students perform the division
                      solution = quot

                      Options and variations

                      • If you want larger numbers, you can increase the intervals for div and quot, but verify readability for students
                      • If you want to include negative results, you can allow negative values in the quotient range
                      • If you want to control difficulty, you can use prime divisors for easier mental calculation, or larger composite divisors for more complexity

                      Common errors

                      Unexpected decimal results.
                      Ensure the dividend is defined as div * quot and not randomly generated.

                      Division by zero error.
                      Confirm the divisor interval excludes 0 (already handled in this example).

                      Trivial exercises (division by 1).
                      Adjust the divisor interval to avoid overly simple cases

                      Related

                      • Understanding Advanced Logic in Nubric
                      • Common Patterns and Best Practices
                      • Glossary of Commands

                      Was this article helpful?

                      Give feedback about this article

                      Related Articles

                      • Long division
                      • Quotient
                      • Arithmetic

                      How to generate a division with no remainder (exact division)

                      Before you begin Steps Verify it worked Full algorithm (copy-paste version) Options and variations Common errors Related

                      Empowering STEM education

                      MathType

                      • Office Tools
                      • LMS
                      • XML
                      • HTML

                      WirisQuizzes

                      Nubric

                      Integrations

                      Solutions

                      • Education
                      • Publishing houses – platforms and interactive
                      • Publishing houses – Print and digital
                      • Technical writers

                      Pricing

                      Downloads

                      Blog

                      • Success stories

                      About us

                      • Careers
                      • Partnership

                      Contact Us

                      Contact Sales

                      European union (European Regional Development Fund) and 1EdTech (TrustEd Apps Certified)
                      • Cookie Policy
                      • Terms of Use
                      • Privacy Policy / GDPR
                      • Student Data Privacy
                      • Compliance
                      • Cookie Settings

                      © Wiris 2026

                      Expand