Created
October 10, 2012 15:51
-
-
Save vertrigo/3866493 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program lab5; | |
| uses Crt; | |
| type matr = array[1..4,1..4] of integer; | |
| var a:matr; i, j, sum, count, mlt:integer; | |
| Begin | |
| ClrScr; | |
| writeln('Введите матрицу:'); | |
| for i:=1 to 4 do | |
| for j:=1 to 4 do read(a[i,j]); | |
| writeln('Исходная матрица:'); | |
| for i:=1 to 4 do begin | |
| for j:=1 to 4 do write(a[i,j]:3); | |
| writeln; | |
| end; | |
| sum:=0; count:=0; mlt:=1; | |
| for i:=1 to 4 do | |
| for j:=1 to 4 do | |
| if (a[i,j] > 0) then | |
| begin | |
| sum:=sum+a[i,j]; | |
| count:=count+1; | |
| end; | |
| mlt:=sum*count; | |
| writeln('Сумма положительных элементов матрицы: ',sum:3); | |
| writeln('Количество положительных элементов матрицы: ',count:3); | |
| writeln('Результат - их произведение: ',mlt:3); | |
| Readkey; | |
| End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment