Jump to content

Pascal's triangle: Difference between revisions

m
(Added Vedit macro language)
Line 10:
=={{header|Ada}}==
<ada>
-- Pascals triangle
 
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
with Ada.Text_Io; use Ada.Text_Io;
Line 47 ⟶ 45:
end Pascals_Triangle;
</ada>
=={{header|ALGOL 68}}==
<pre>
PRIO MINLWB = 8, MAXUPB = 8;
OP MINLWB = ([]INT a,b)INT: (LWB a<LWB b|LWB a|LWB b),
MAXUPB = ([]INT a,b)INT: (UPB a>UPB b|UPB a|UPB b);
 
OP + = ([]INT a,b)[]INT:(
[a MINLWB b:a MAXUPB b]INT out; FOR i FROM LWB out TO UPB out DO out[i]:= 0 OD;
out[LWB a:UPB a] := a; FOR i FROM LWB b TO UPB b DO out[i]+:= b[i] OD;
out
);
 
INT width = 4, stop = 9;
FORMAT centre = $n((stop-UPB row+1)*width OVER 2)(q)$;
 
FLEX[1]INT row := 1; # example of rowing #
FOR i WHILE
printf((centre, $g(-width)$, row, $l$));
# WHILE # i < stop DO
row := row[AT 1] + row[AT 2]
OD</pre>
Output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
 
=={{header|BASIC}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.