ZiegelMan

var3

May 14th, 2020
288
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program var3;
  2. var
  3.   mtrx: array[1 ..10, 1..12] of integer;
  4.   sum,num,i,j: integer;
  5.   f1: text;
  6. begin
  7.   assign(f1, 'matr.txt');
  8.   rewrite(f1);
  9.   for i:=1 to 10 do begin
  10.     for j:=1 to 12 do begin
  11.       mtrx [i,j]:=random(21)-10;
  12.       write(f1, mtrx[i,j]:4);
  13.       write(mtrx [i,j]:4);
  14.       if (i mod 2=0) and (mtrx[i,j]<0) then begin
  15.         sum:=sum+mtrx[i,j];
  16.         num:=num+1;
  17.       end;
  18.     end;
  19.     writeln();
  20.     writeln(f1);
  21.   end;
  22.   writeln();
  23.   writeln(f1);
  24.   writeln('сумма:', sum);
  25.   writeln(f1, 'сумма:', sum);
  26.   writeln('кол-во: ',num);
  27.   writeln(f1,'кол-во: ',num);
  28.   close(f1);
  29. end.
RAW Paste Data