Sum of elements below main diagonal of matrix: Difference between revisions

Content added Content deleted
Line 1,128: Line 1,128:
69
69
</pre>
</pre>
==={{header|PL/I}}===
<lang PL/I>
trap: procedure options (main); /* 17 December 2021 */
declare n fixed binary;
get (n);
put ('The order of the matrix is ' || trim(n));
begin;
declare A (n,n) fixed binary;
declare sum fixed binary;
declare (i, j) fixed binary;

get (A);
sum = 0;
do i = 2 to n;
do j = 1 to i-1;
sum = sum + a(i,j);
end;
end;
put edit (A) (skip, (n) f(4) );
put skip data (sum);
end;
end trap;
</lang>
{{out}}
<pre>
The order of the matrix is 5

1 3 7 8 10
2 4 16 14 4
3 1 9 18 11
12 14 17 18 20
7 1 3 9 5
SUM= 69;
</pre>

=={{header|PL/M}}==
=={{header|PL/M}}==
This can be compiled with the original 8080 PL/M compiler and run under CP/M or an emulator/clone.
This can be compiled with the original 8080 PL/M compiler and run under CP/M or an emulator/clone.