Jump to content

Floyd's triangle: Difference between revisions

m
m (→‎{{header|Ada}}: fixed a minor bug)
Line 23:
Rows: constant Positive := Integer'Value(Ada.Command_Line.Argument(1));
Last_Number:constant Positive := (Rows * (Rows+1)) / 2;
 
Width: array(1 .. Rows) of Positive;
 
Current: Positive := 1;
Width: array(1 .. Rows) of Positive;
 
begin
-- compute the width for the different columns
for I in Width'Range loop
Width(I) := Integer'Image(I + (Rows * (Rows-1))/2)'Length;
end loop;
-- output the triangle
for Line in 1 .. Rows loop
for Column in 1 .. Line loop
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.