Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Vikysya; // https://otvet.mail.ru/question/183719338
- const n=5; // Размер квадратной матрицы
- var matrix:array[1..n,1..n] of integer;
- sum,count:integer;
- i,j:byte;
- Begin
- Count:=0;
- Sum:=0;
- Writeln('Исходная матрица:');
- for i:=1 to n do
- Begin
- for j:=1 to n do
- Begin
- Matrix[i,j]:=Random(51)-25;
- Write(Matrix[i,j]:5);
- if (j > i) and (Matrix[i,j] > 0) then
- Begin
- Inc(Sum,Matrix[i,j]);
- Inc(Count);
- end;
- end;
- Writeln;
- end;
- Writeln;
- Writeln('Сумма положительных элементов: ',Sum);
- Writeln('Количество положительных элементов: ',Count);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement