# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
205 lines (167 sloc) 8.31 KB
 Even and odd integers
["+", "m", "n"] { "even": "blue", "odd": "orange" } { "m": rand(2) === 0, "n": rand(2) === 0 } 2 getHints( EXPR, IS_EVENS, EORO_COLORS, EXPR, EXPR_LEVELS )
• m is evenOrOdd( "m", IS_EVENS ).
• n is evenOrOdd( "n", IS_EVENS ).

Is expr( EXPR ) even or odd?

( isExprEven( EXPR, IS_EVENS ) ? "Even" : "Odd" )

• Even
• Odd
init({ range: [[0, 10], [-2, EXPR_LEVELS]], scale: [40, 40] }); label( [0, EXPR_LEVELS], "\\large{" + expr( EXPR ) + "}", "below right" );
HINTS[I].graph( KhanUtil.currentGraph );

HINT.text

["times", "m", "n"]
["+", ["times", randRange(2, 5), "n"], ["times", randRange(2, 5), "m"]] 3
["+", "m", ["+", "n", "p"]] { "m": rand(2) === 0, "n": rand(2) === 0, "p": rand(2) === 0 } 3
• m is evenOrOdd( "m", IS_EVENS ).
• n is evenOrOdd( "n", IS_EVENS ).
• p is evenOrOdd( "p", IS_EVENS ).
["times", "n", ["+", "m", "p"]]
["+", ["-", ["times", "n", "p"], "m"], "p"]
Something went wrong with that request. Please try again.