Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Matrix
program MatrixEleme; label err1; const max1=50; max2=50; type matrix=array[1..max1,1..max2] of integer; var a:matrix; i,j,n,m:integer; procedure makematrix(var a:matrix; var n,m:integer); label err; begin writeln('Input dimensions of matrix: '); read(n,m); if (n<0) or (n>max1) or (m<0) or (m>max2) then goto err; for i:=1 to n do for j:=1 to m do read(a[i][j]); err:end; procedure writematrix(a:matrix;n,m:integer); begin writeln('Ypur matrix is: '); for i:=1 to n do begin for j:=1 to m do write(a[i][j],' '); writeln() end end; function countcol(a:matrix;br,i,m:integer):integer; var k,j:integer; begin k:=0; for j:=1 to m do if(a[i][j]=br) then k:=k+1; countcol:=k end; function countrow(a:matrix;br,j,n:integer):integer; var k,i:integer; begin k:=0; for i:=1 to n do if(a[i][j]=br) then k:=k+1; countrow:=k end; procedure processing(a:matrix;n,m:integer); var k,v:integer; begin writeln('Found numbers are: '); for i:=1 to n do for j:=1 to m do begin k:=countcol(a,a[i][j],i,m); v:=countrow(a,a[i][j],j,n); if(k=v) then writeln('Number ',a[i][j],' on position ',i,',',j); end end; begin makematrix(a,n,m); if (n<0) or (n>max1) or (m<0) or (m>max2) then goto err1; writematrix(a,n,m); processing(a,n,m); err1:end.
run
|
edit
|
history
|
help
0
Opdracht_2
1
eliminar elementos de un arreglo
123456
Tangga angka
Potenztabelle
Projet1
matrix - changing upper diagonal elements
x=2;n=3
zadanye 3 a