Last active
December 11, 2015 06:19
-
-
Save vertrigo/4558408 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uses crt; | |
const n=3; | |
Type matr=array[1..n,1..n] of integer; | |
Var a,b,c:matr; max,sm,i:integer; | |
m:array[1..3] of integer; | |
Procedure InMatr(Var d:matr; n:integer; matr_name:char); | |
Var i,j:integer; | |
begin | |
writeln('Vvedite matricy ',matr_name,' iz ', n, ' elementov:'); | |
for i:=1 to n do | |
for j:=1 to n do read(d[i,j]) | |
end; | |
Procedure OutMatr(d:matr;n:integer;Matr_name:char); | |
Var i,j:integer; | |
begin | |
writeln('Matricha ',matr_name,':'); | |
for i:=1 to n do begin | |
for j:=1 to n do write(d[i,j]:3); | |
writeln | |
end; | |
end; | |
Function Summ(d:matr;n:integer):integer; | |
Var i,j,s:integer; | |
begin | |
s:=0; | |
for i:=1 to n do | |
for j:=1 to n do | |
if i > j then s:=s+d[i,j]; | |
Summ:=s; | |
end; | |
Begin | |
clrscr; | |
InMatr(a,3,'A'); InMatr(b,3,'B'); InMatr(c,3,'C'); | |
OutMatr(a,3,'A'); OutMatr(b,3,'B'); OutMatr(c,3,'C'); | |
m[1]:=summ(a,3); | |
m[2]:=summ(b,3); | |
m[3]:=summ(c,3); | |
max:=-maxint; | |
for i:=1 to 3 do | |
if m[i] >= max then max:=m[i]; | |
writeln('Max iz summ: '); | |
writeln(max); | |
readkey; | |
End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment