Pascal's triangle: Difference between revisions

Content added Content deleted
Line 346: Line 346:
<syntaxhighlight lang="Amazing Hopper">
<syntaxhighlight lang="Amazing Hopper">
#include <jambo.h>
#include <jambo.h>
#define Mulbyandmoveto(_X_) Mul by '_X_', Move to '_X_'


Main
Main
Line 354: Line 355:
Set 'c' To str, Move to 'r'
Set 'c' To str, Move to 'r'
Loop if ( var 'j' Is less than 'i' )
Loop if ( var 'j' Is less than 'i' )
Set 'i' Minus 'j', Plus one 'j', Div it, Mul by 'c', Move to 'c'
Set 'i' Minus 'j', Plus one 'j', Div it; Mul by and move to 'c'
Cat ( r, Cat ( "\t", Str(c) ) ), Move to 'r'
Multi cat ' r, "\t", Str(c) '; Move to 'r'
++j
++j
Back
Back
Line 365: Line 366:
{{out}}
{{out}}
<pre>
<pre>
$ hopper jm/pascal.jambo 15
$ hopper jm/pascal.jambo 14
1
1
1 1
1 1
Line 380: Line 381:
1 12 66 220 495 792 924 792 495 220 66 12 1
1 12 66 220 495 792 924 792 495 220 66 12 1
1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1
1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1

1 14 91 364 1001 2002 3003 3432 3003 2002 1001 364 91 14 1
</pre>
</pre>