1)var ma:array[1..3,1..3] of integer; i,j,t:integer; begin; randomize; readln(t); writeln('Matrix:'); for i:=1 to 3 do begin; writeln; for j:=1 to 3 do begin; ma[i,j]:=random(10); write(ma[i,j]:4); ma[i,j]:=ma[i,j]*t; end; end; writeln; writeln('Final matrix:'); for i:=1 to 3 do begin; writeln; for j:=1 to 3 do write(ma[i,j]:4); end; end. 2)var ma:array of array of real; i,j,n,m,maxj,maxi:integer; max:real; begin; readln(n); readln(m); setlength(ma,n+1); for i:=1 to n do setlength(ma[i],m+1); max:=-2147483648; writeln('Matrix:'); for i:=1 to n do begin; writeln; for j:=1 to m do begin; ma[i,j]:=random(100)-50; write(ma[i,j]:4); if (ma[i,j]<0) and (ma[i,j]>max) then begin; max:=ma[i,j]; maxi:=i; maxj:=j; end; end; end; writeln; writeln('Max:',max); writeln('Строка:',maxi); write('Столбец:',maxj); end.
using namespace std;
int main(){
setlocale(LC_ALL,"Rus");
int N,dp,S,F,d;
S=0;F=0;d=0;
while(S<1){
cout<<"Выберите действие"<<endl;
cout<<"1.Ввод чисел"<<endl;
cout<<"2.Подсчет среднего арифметического"<<endl;
cout<<"Выполнить действие-";
cin>>dp;
switch(dp){
case 1:
cout<<"Введите число ";
cin>>N;
F=F+N;
d++;
break;
case 2:
S=(float)F/d;
break;
}
}
cout<<"Среднее арифметическое="<<S<<endl; system("pause");
return 0;
}
i,j,t:integer;
begin;
randomize;
readln(t);
writeln('Matrix:');
for i:=1 to 3 do
begin;
writeln;
for j:=1 to 3 do
begin;
ma[i,j]:=random(10);
write(ma[i,j]:4);
ma[i,j]:=ma[i,j]*t;
end;
end;
writeln;
writeln('Final matrix:');
for i:=1 to 3 do
begin;
writeln;
for j:=1 to 3 do
write(ma[i,j]:4);
end;
end.
2)var ma:array of array of real;
i,j,n,m,maxj,maxi:integer;
max:real;
begin;
readln(n);
readln(m);
setlength(ma,n+1);
for i:=1 to n do
setlength(ma[i],m+1);
max:=-2147483648;
writeln('Matrix:');
for i:=1 to n do
begin;
writeln;
for j:=1 to m do
begin;
ma[i,j]:=random(100)-50;
write(ma[i,j]:4);
if (ma[i,j]<0) and (ma[i,j]>max) then
begin;
max:=ma[i,j];
maxi:=i;
maxj:=j;
end;
end;
end;
writeln;
writeln('Max:',max);
writeln('Строка:',maxi);
write('Столбец:',maxj);
end.