diff -r fddf099a82f8 -r 64ec1884d860 solutions/cw4/pascal.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/solutions/cw4/pascal.while Wed Feb 21 09:14:12 2024 +0000 @@ -0,0 +1,35 @@ +rows := 13; +coef := 1; + +i := 0; +while (i < rows) do { + + space := 1; + + while (space <= rows - i) do { + write(" "); + space := space + 1 + }; + + j := 0; + while (j <= i) do { + + if ((j == 0) || i == 0) then { + coef := 1 + } else { + coef := (coef * ((i - j) + 1)) / j + }; + + if (coef < 10) then write(" ") else + if (coef < 100) then write(" ") else + if (coef < 1000) then write(" ") + else skip; + + write(coef); + j := j + 1 + }; + + + write("\n"); + i := i + 1 +}