Skip to content
This repository
Browse code

Added new exercise Understanding moving the decimal

  • Loading branch information...
commit 652c8897e936a10257a346302f8025c6b9c23a8c 1 parent c66b0ab
Praveen Ramalingam praveenRamalingam authored beneater committed

Showing 1 changed file with 53 additions and 0 deletions. Show diff stats Hide diff stats

  1. +53 0 exercises/understanding_moving_the_decimal.html
53 exercises/understanding_moving_the_decimal.html
... ... @@ -0,0 +1,53 @@
  1 +<!DOCTYPE html>
  2 +<html data-require="math word-problems">
  3 +<head>
  4 + <meta charset="UTF-8" />
  5 + <title>Understanding moving the decimal</title>
  6 + <script src="../khan-exercise.js"></script>
  7 +</head>
  8 +<body>
  9 + <div class="exercise">
  10 + <div class="vars">
  11 + <var id="PM">randRangeNonZero( -1, 1 )</var>
  12 + <var id="OPERATOR">( PM === 1 ? "multiply" : "divide" )</var>
  13 + <var id="A">randRange( 0, 99999 )</var>
  14 +
  15 + <div data-ensure="( PM === 1 ? A_DECIMAL > B_DECIMAL : A_DECIMAL < B_DECIMAL )">
  16 + <var id="A_DECIMAL">randRange( 1, 5 )</var>
  17 + <var id="B_DECIMAL">randRange( 1, 5 )</var>
  18 + </div>
  19 +
  20 + <var id="A_FLOAT">A / pow( 10, A_DECIMAL )</var>
  21 + <var id="B_FLOAT">A / pow( 10, B_DECIMAL )</var>
  22 + <var id="POW_DIFF">( PM === 1 ? ( A_DECIMAL - B_DECIMAL ) : ( B_DECIMAL - A_DECIMAL ) )</var>
  23 + </div>
  24 +
  25 + <div class="problems">
  26 + <div>
  27 + <div class="question">
  28 + <p><var>person(1)</var> needs to <var>OPERATOR</var> <var>A_FLOAT.toFixed( A_DECIMAL )</var> by 10 <b>?</b> times to get <var>B_FLOAT.toFixed( B_DECIMAL )</var></p>
  29 + </div>
  30 +
  31 + <p class="solution" data-forms="integer"><var>POW_DIFF</var></p>
  32 + </div>
  33 + </div>
  34 +
  35 + <div class="hints">
  36 + <div>
  37 + <p><span data-if="PM === 1">Moving the decimal one position to the right is the same as <var>person(1)</var> multiplying the number by 10.</span>
  38 + <span data-else>Moving the decimal one position to the left is the same as <var>person(1)</var> dividing the number by 10.</span></p>
  39 + </div>
  40 +
  41 + <div data-if="PM === 1">
  42 + <p>Moving the decimal right <var>POW_DIFF</var> is the same as multiplying the number by 10 <var>POW_DIFF</var> times.</p>
  43 + <p>This is the same as multiplying the number by <var>pow( 10, POW_DIFF )</var>:</p>
  44 + <p><code>{<var>A_FLOAT.toFixed( A_DECIMAL )</var>} * {<var>pow( 10, POW_DIFF )</var>} = {<var>B_FLOAT.toFixed( B_DECIMAL )</var>}</code></p></div>
  45 + <div data-else>
  46 + <p>Moving the decimal left <var>POW_DIFF</var> is the same as dividing the number by 10 <var>POW_DIFF</var> times.</p>
  47 + <p>This is the same as dividing the number by <var>pow( 10, POW_DIFF )</var>:</p>
  48 + <p><code>{<var>A_FLOAT.toFixed( A_DECIMAL )</var>} / {<var>pow( 10, POW_DIFF )</var>} = {<var>B_FLOAT.toFixed( B_DECIMAL )</var>}</code></p>
  49 + </div>
  50 + </div>
  51 + </div>
  52 +</body>
  53 +</html>

0 comments on commit 652c889

Please sign in to comment.
Something went wrong with that request. Please try again.