Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Use ordinal function
Browse files Browse the repository at this point in the history
  • Loading branch information
petercollingridge committed Feb 19, 2013
1 parent bc728f6 commit 04c8cdc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions exercises/integer_sums.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html data-require="math word-problems">
<html data-require="math math-format word-problems">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Integer sums</title>
Expand All @@ -12,8 +12,6 @@
<var id="SEQ_LENGTH">randRange(2, 6)</var>
<var id="DIFFERENCE">randRange(1, 2)</var>
<var id="TARGET_NUMBER">randRange(1, SEQ_LENGTH)</var>
<var id="ORDINAL">["zeroth", "first", "second", "third", "forth", "fifth", "sixth"][TARGET_NUMBER]</var>

<var id="C">DIFFERENCE * SEQ_LENGTH * (SEQ_LENGTH - 1) / 2</var>
<var id="SUM">FIRST_NUM * SEQ_LENGTH + C</var>
<var id="SEQ_TYPE">
Expand Down Expand Up @@ -42,7 +40,7 @@
<div class="problems">
<div>
<p class="problem">The sum of <var>SEQ_LENGTH</var> consecutive <var>SEQ_TYPE</var>s is <var>SUM</var>.</p>
<p class="question">What is the <var>ORDINAL</var> number in this sequence?</p>
<p class="question">What is the <var>ordinal(TARGET_NUMBER)</var> number in this sequence?</p>
<p class="solution" data-forms="integer"><var>ANSWER</var></p>
</div>
</div>
Expand All @@ -61,8 +59,11 @@
<p>Thus, the first number is <code><var>ANSWER</var></code>.</p>
</div>
<div data-else>
<p>Since <code>x</code> is the first number, <code>x + <var>(TARGET_NUMBER - 1) * DIFFERENCE</var></code> is the <var>ORDINAL</var> <var>SEQ_TYPE</var>.</p>
<p>Thus, the <var>ORDINAL</var> number in the sequence is <code><var>ANSWER</var></code>.</p>
<p>
Since <code>x</code> is the first number, <code>x + <var>(TARGET_NUMBER - 1) * DIFFERENCE</var></code>
is the <var>ordinal(TARGET_NUMBER)</var> <var>SEQ_TYPE</var>.
</p>
<p>Thus, the <var>ordinal(TARGET_NUMBER)</var> number in the sequence is <code><var>ANSWER</var></code>.</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 04c8cdc

Please sign in to comment.