Sub Ìàêðîñ1() Dim Sum(heigth - 1, width - 1) Dim Product(heigth - 1, width - 1)
For i = 0 To heigth - 1 For j = 0 To width - 1 Sum(i, j) = i + j Product(i, j) = i * j Next j Next i
Call Show(Sum, 0, 0) Call Show(Product, 0, 12) End Sub
Sub Show(ByRef m, dx, dy) For i = 0 To heigth - 1 For j = 0 To width - 1 ActiveSheet.Cells(dx + i + 1, dy + j + 1).Value = Hex(m(i, j)) Next j Next i End Sub
// PascalABC.NET 3.0, сборка 1144 от 16.01.2016 begin var n:=ReadInteger('n='); var a:=ArrRandom(n,-50,50); Writeln('Исходный массив'); a.Println; var se:=a.Where(x->x mod 3=0); if se.Count=0 then Writeln('В массиве нет элементов, кратных трем') else begin var b:=se.Max; var i:=0; while a[i]<>b do Inc(i); if i=n-1 then Writeln('Максимальный элемент - последний') else begin Writeln('Результирующий массив'); a[i+1]:=abs(a.Where(x->x<0).Sum); a.Println end end end.
Const width = 10
Sub Ìàêðîñ1()
Dim Sum(heigth - 1, width - 1)
Dim Product(heigth - 1, width - 1)
For i = 0 To heigth - 1
For j = 0 To width - 1
Sum(i, j) = i + j
Product(i, j) = i * j
Next j
Next i
Call Show(Sum, 0, 0)
Call Show(Product, 0, 12)
End Sub
Sub Show(ByRef m, dx, dy)
For i = 0 To heigth - 1
For j = 0 To width - 1
ActiveSheet.Cells(dx + i + 1, dy + j + 1).Value = Hex(m(i, j))
Next j
Next i
End Sub