annotate lab2/pascal.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
mike@0 1 (* lab2/pascal.p *)
mike@0 2
mike@0 3 var a: array 5 of array 5 of integer;
mike@0 4 var i, j: integer;
mike@0 5
mike@0 6 begin
mike@0 7 i := 0;
mike@0 8 while i < 5 do
mike@0 9 a[i][0] := 1; j := 1;
mike@0 10 print a[i][0];
mike@0 11 while j <= i do
mike@0 12 a[i][j] := a[i-1][j-1] + a[i-1][j];
mike@0 13 print a[i][j];
mike@0 14 j := j+1
mike@0 15 end;
mike@0 16 newline;
mike@0 17 i := i+1
mike@0 18 end
mike@0 19 end.
mike@0 20
mike@0 21 (*<<
mike@0 22 1
mike@0 23 1 1
mike@0 24 1 2 1
mike@0 25 1 3 3 1
mike@0 26 1 4 6 4 1
mike@0 27 >>*)