Sub num1() s = 0 n = CInt(InputBox("N =")) Range(Cells(1, 1), Cells(2 * (n + 2), n + 2)).Clear ReDim A(n - 1) ReDim B(n - 1)
k = 1 Cells(k, 1).Value = "A" Cells(k + 2, 1).Value = "B" k = k + 1
m = -1 For i = LBound(A, 1) To UBound(A, 1) A(i) = Round(Rnd * 10) - 5 Cells(k, 1 + i).Value = A(i) If A(i) = 0 Then m = m + 1 B(m) = i Cells(k + 2, m + 1).Value = B(m) End If Next End Sub
Sub num2() n = 16 ReDim A(n, n), C(n, n), E(n, n) Range(Cells(1, 1), Cells(2 * (n + 2), n + 2)).Clear
k = 1 Cells(k, 1).Value = "Init"
k = k + 1 Cells(k + n + 1, 1).Value = "Result"
For i = 0 To n For j = 0 To n A(i, j) = Round(Rnd * 10) Cells(k + i, j + 1).Value = A(i, j)
If i = j Then E(i, j) = 1 Else E(i, j) = 0
C(i, j) = 0 For r = 0 To n C(i, j) = C(i, j) + A(i, r) * A(r, j) Next
x = 6 * (C(i, j) + E(i, j)) Cells(k + n + 2 + i, j + 1).Value = x Next Next End Sub
s = 0
n = CInt(InputBox("N ="))
Range(Cells(1, 1), Cells(2 * (n + 2), n + 2)).Clear
ReDim A(n - 1)
ReDim B(n - 1)
k = 1
Cells(k, 1).Value = "A"
Cells(k + 2, 1).Value = "B"
k = k + 1
m = -1
For i = LBound(A, 1) To UBound(A, 1)
A(i) = Round(Rnd * 10) - 5
Cells(k, 1 + i).Value = A(i)
If A(i) = 0 Then
m = m + 1
B(m) = i
Cells(k + 2, m + 1).Value = B(m)
End If
Next
End Sub
Sub num2()
n = 16
ReDim A(n, n), C(n, n), E(n, n)
Range(Cells(1, 1), Cells(2 * (n + 2), n + 2)).Clear
k = 1
Cells(k, 1).Value = "Init"
k = k + 1
Cells(k + n + 1, 1).Value = "Result"
For i = 0 To n
For j = 0 To n
A(i, j) = Round(Rnd * 10)
Cells(k + i, j + 1).Value = A(i, j)
If i = j Then E(i, j) = 1 Else E(i, j) = 0
C(i, j) = 0
For r = 0 To n
C(i, j) = C(i, j) + A(i, r) * A(r, j)
Next
x = 6 * (C(i, j) + E(i, j))
Cells(k + n + 2 + i, j + 1).Value = x
Next
Next
End Sub
Program zd4;
uses CRT;
type mas=array[1..20,1..20] of real;
var A:mas; g,b,i,j,n,m,nom1,nom2:integer; max:real;
Begin
clrscr;
write ('Введите размер массива: ');
readln (n,m);
write ('Введите диапазон чисел в массиве: ');
readln (g,b);
Randomize;
For i:=1 to n do
Begin
For j:=1 to m do
Begin
A[i,j]:=random(b-g)+g;
write (A[i,j]:5:0,' ');
End;
writeln;
End;
nom1:=1;
nom2:=1;
max:=a[1,1];
For i:=1 to n do
Begin
For j:=1 to m do
Begin
If a[i,j]>max then
Begin
max:=A[i,j];
nom1:=j;
nom2:=i;
End;
End;
End;
writeln ('Максимальный элемент массива= ',max:5:0,' ,его координаты ','[',nom1,',',nom2,']');
readln;
End.
Так?