Var a : array [1..3] of array [1..3] of integer; i,j : shortint; c1,c2,s1,s2 : integer;
begin a[1][1]:=-10; a[1][2]:=20; a[1][3]:=13; a[2][1]:=-22; a[2][2]:=11; a[2][3]:=-5; a[3][1]:=4; a[3][2]:=12; a[3][3]:=-8; s1:=0; s2:=0; c1:=0; c2:=0; for i:=1 to 3 do begin for j:=1 to 3 do begin if a[i][j]>0 then begin s1:=s1+a[i][j]; inc (c1); end else begin s2:=s2+a[i][j]; inc (c2); end; end; end; writeln (s1/c1:0:0); writeln (s2/c2:0:2); end.
Program Pr1; uses crt; var mas:array[100..999] of integer; i:integer; Begin clrscr; for i:=100 to 999 do mas[i]:=i; {1 sposob} for i:=100 to 999 do if mas[i] mod 9 =0 then writeln(mas[i]); i:=100; {2 sposob} while i<=999 do begin if mas[i] mod 9=0 then writeln(mas[i]); i:=i+1; end; i:=100; {3 sposob} repeat if mas[i] mod 9=0 then writeln(mas[i]); i:=i+1 until i=999 end.
2)
Program Pr1; uses crt; var mas:array[100..999] of integer; i,v:integer; Begin clrscr; v:=0; for i:=100 to 999 do mas[i]:=i; {1 sposob} for i:=100 to 999 do if mas[i] mod 17 =0 then v:=v+mas[i]; writeln(v); i:=100; {2 sposob} v:=0; while i<=999 do begin if mas[i] mod 17=0 then v:=v+mas[i];; i:=i+1; end; writeln(v); i:=100; {3 sposob} v:=0; repeat if mas[i] mod 17=0 then v:=v+mas[i]; i:=i+1 until i=999; writeln(v); end.
i,j : shortint;
c1,c2,s1,s2 : integer;
begin
a[1][1]:=-10;
a[1][2]:=20;
a[1][3]:=13;
a[2][1]:=-22;
a[2][2]:=11;
a[2][3]:=-5;
a[3][1]:=4;
a[3][2]:=12;
a[3][3]:=-8;
s1:=0; s2:=0; c1:=0; c2:=0;
for i:=1 to 3 do begin
for j:=1 to 3 do begin
if a[i][j]>0 then begin
s1:=s1+a[i][j];
inc (c1);
end else begin
s2:=s2+a[i][j];
inc (c2);
end;
end;
end;
writeln (s1/c1:0:0);
writeln (s2/c2:0:2);
end.
1)
Program Pr1;
uses crt;
var mas:array[100..999] of integer;
i:integer;
Begin
clrscr;
for i:=100 to 999 do mas[i]:=i; {1 sposob}
for i:=100 to 999 do if mas[i] mod 9 =0 then writeln(mas[i]);
i:=100; {2 sposob}
while i<=999 do begin
if mas[i] mod 9=0 then writeln(mas[i]);
i:=i+1;
end;
i:=100; {3 sposob}
repeat
if mas[i] mod 9=0 then writeln(mas[i]);
i:=i+1
until i=999
end.
2)
Program Pr1;
uses crt;
var mas:array[100..999] of integer;
i,v:integer;
Begin
clrscr;
v:=0;
for i:=100 to 999 do mas[i]:=i; {1 sposob}
for i:=100 to 999 do if mas[i] mod 17 =0 then v:=v+mas[i];
writeln(v);
i:=100; {2 sposob}
v:=0;
while i<=999 do begin
if mas[i] mod 17=0 then v:=v+mas[i];;
i:=i+1;
end;
writeln(v);
i:=100; {3 sposob}
v:=0;
repeat
if mas[i] mod 17=0 then v:=v+mas[i];
i:=i+1
until i=999;
writeln(v);
end.