Advertisement
Alex_Fomin

Викуся

Nov 2nd, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.89 KB | None | 0 0
  1. Program Vikysya; // https://otvet.mail.ru/question/183719338
  2.  
  3. const n=5; // Размер квадратной матрицы
  4.  
  5. var matrix:array[1..n,1..n] of integer;
  6.     sum,count:integer;
  7.     i,j:byte;
  8.    
  9. Begin
  10. Count:=0;
  11. Sum:=0;
  12. Writeln('Исходная матрица:');
  13. for i:=1 to n do
  14.     Begin
  15.     for j:=1 to n do
  16.         Begin
  17.         Matrix[i,j]:=Random(51)-25;
  18.         Write(Matrix[i,j]:5);
  19.         if (j > i) and (Matrix[i,j] > 0) then
  20.                                              Begin
  21.                                              Inc(Sum,Matrix[i,j]);
  22.                                              Inc(Count);
  23.                                              end;
  24.         end;
  25.     Writeln;
  26.     end;
  27. Writeln;
  28. Writeln('Сумма положительных элементов: ',Sum);
  29. Writeln('Количество положительных элементов: ',Count);
  30. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement