Salut, am nevoie de ajutor.
De la tastiera se citesc elementele de tip intreg ale unui tablou bidimensional de m linii si n coloane. De scris un program care va inlocui zerourile cu unitati. Adica 0=1.
Ms anticipat, dau coroana!
IN LIMBAJUL DE PROGRAMARE PASCAL !
Răspunsuri la întrebare
program p4;
const nmax=100;
type matrice=array[1..nmax,1..nmax] of integer;
var a: matrice; n, m,i,j:integer;
begin
write('n='); readln(n);
write('m='); readln(m);
writeln('introdu elementele matricei:');
for i:=1 to n do
for j:=1 to m do
begin
write('a[',i,',',j,']=');readln(a[i,j]);
if a[i,j]=0 then a[i,j]:=1;
end;
writeln('matricea modificata...');
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j], ' ');
writeln;
end;
end.
Program brainly;
var
tablou : array[1..100, 1..100] of integer;
i,j,n,m:integer;
begin
write('Dati n(coloane):');
read(n);
write('Dati m(randuri):');
read(m);
writeln('Dati valorile tabloului:');
for i:=1 to n do
for j:=1 to m do
begin
write('A[',i,'][',j,']=');
read(tablou[i][j]);
end;
for i:=1 to n do
for j:=1 to m do
begin
if tablou[i][j] = 0 then tablou[i][j]:=1;
end;
for i:=1 to n do begin
writeln;
for j:=1 to m do
write(' ',tablou[i][j],' ');
end;
end.