Created
January 8, 2014 16:04
-
-
Save selevit/8319148 to your computer and use it in GitHub Desktop.
This file contains 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 matr; | |
type | |
matrix = array [1..5, 1..3] of integer; | |
var | |
a: matrix; { двумерный массив } | |
i, j: integer; { индексы массива } | |
{ количество элементов массива, которые без остатка | |
делятся на собственный индекс (строки или столбца } | |
cnt: integer; | |
begin | |
cnt := 0; | |
{ ввод двумерного массива с клавиатуры } | |
for i := 1 to 5 do { перебор всех строк } | |
for j := 1 to 3 do begin { перебор всех элементов по столбцам } | |
write('a[', i, '][', j, '] = '); | |
readln(a[i, j]); | |
if (a[i, j] mod i = 0) or (a[i, j] mod j = 0) then | |
cnt := cnt + 1; | |
end; | |
writeln('Количество искомых элементов: ', cnt); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment