Объяснение:
1.
Sub Button1_click()
Dim matrix(1 To 2, 1 To 3) As Integer
For i = 1 To 3
matrix(1, i) = 1 ^ 2 + i ^ 2
matrix(2, i) = -matrix(1, i)
Next i
prompt = ""
For i = 1 To 2
For j = 1 To 3
If matrix(i, j) > 0 Then
prompt = prompt & " " & matrix(i, j)
Else
prompt = prompt & " " & matrix(i, j)
End If
Next j
prompt = prompt & Chr(13)
Next i
MsgBox prompt
End Sub
10.
Sub Button1_click()
Dim matrix(1 To 2, 1 To 3) As Integer
upperbound = 25
lowerbound = -25
For i = 1 To 2
For j = 1 To 3
Randomize
matrix(i, j) = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Next j
Next i
prompt = ""
For i = 1 To 2
For j = 1 To 3
If Abs(matrix(i, j)) > 9 And Abs(matrix(i, j)) < 99 Then
prompt = prompt & "A(" & i & "," & j & ")=" & matrix(i, j) & Chr(13)
End If
Next j
Next i
prompt = prompt & Chr(13)
For i = 1 To 2
For j = 1 To 3
If matrix(i, j) > 0 Then
prompt = prompt & " " & matrix(i, j)
Else
prompt = prompt & " " & matrix(i, j)
End If
Next j
prompt = prompt & Chr(13)
Next i
MsgBox prompt
End Sub
11.
Sub Button1_click()
Dim matrix(1 To 9, 1 To 9) As Integer
For i = 1 To 9
For j = 1 To 9
If i = j Or i = 9 + 1 - j Then
matrix(i, j) = 1
Else
matrix(i, j) = 0
End If
Next j
Next i
prompt = ""
For i = 1 To 9
For j = 1 To 9
prompt = prompt & " " & matrix(i, j)
Next j
prompt = prompt & Chr(13)
Next i
MsgBox prompt
End Sub
Поделитесь своими знаниями, ответьте на вопрос:
Составьте 2 рабочих программы на языке паскаль для работы в pascalabc. желательно с пояснениями.
const max=30;
var c:array[1..max,1..max] of integer;
m,n,i,j,p,k,s:integer;
begin
randomize;
repeat
write('Количество строк от 2 до ',max,' m=');
readln(m);
until m in [2..max];
repeat
write('Количество столбцов от 2 до ',max,' n=');
readln(n);
until n in [2..max];
writeln('Исходная матрица');
for i:=1 to m do
begin
for j:=1 to n do
begin
c[i,j]:=-10+random(21);
write(c[i,j]:4);
end;
writeln;
end;
write('P=');
readln(p);
k:=0;
for i:=1 to m do
begin
s:=0;
for j:=1 to n do
if c[i,j]>0 then s:=s+c[i,j];
if s>p then k:=k+1;
end;
write('Количество строк по условию=',k)
end.