Відповідь:
1 const
2 n=5;
3 var
4 a:array[1..n,1..n] of integer;
5 i,j,s:integer;
6 begin
7 s:=0;
8 randomize;
9 for i:=1 to n do
10 begin
11 for j:=1 to n do
12 begin
13 a[i,j]:=random(10);
14 write(a[i,j]:4);
15 if (i+j) mod 3=0 then
16 s:=s+a[i,j];
17 end;
18 writeln;
19 end;
20 writeln('S=',s);
21 end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Відповідь:
1 const
2 n=5;
3 var
4 a:array[1..n,1..n] of integer;
5 i,j,s:integer;
6 begin
7 s:=0;
8 randomize;
9 for i:=1 to n do
10 begin
11 for j:=1 to n do
12 begin
13 a[i,j]:=random(10);
14 write(a[i,j]:4);
15 if (i+j) mod 3=0 then
16 s:=s+a[i,j];
17 end;
18 writeln;
19 end;
20 writeln('S=',s);
21 end.