Изменить программу, чтобы работала в Паскале: Const Sz=100; Var i: Integer; a:array[1..Sz]of integer; N:Integer ; Begin N:=20; For i:=1 to N do a[i]:=random (100); WriteLn('Эл. массива'); For i:=1 to N do Write (a[i], ' '); WriteLn ; For i:=1 to N div 2 do Swap(a[i],a[N-i+1]); WriteLn('После инвертирования:'); For i:=1 to N do Write (a[i], ' '); End.
var pos,neg: integer; i,k,x: integer; ev,un: integer; a,b: array [1..n] of integer;
begin for i := 1 to n do read(a[i]); k := 0; pos := 0; neg := 0; for i := 1 to n do begin ev := 0; un := 0; x := a[i]; if x <> 0 then if x > 0 then if (x < pos) or (pos = 0) then pos := x else else if (x > neg) or (neg = 0) then neg := x; x := abs(x); while x <> 0 do begin if odd(x) then un := un + 1 else ev := ev + 1; x := x div 10 end; if un = ev then begin k := k + 1; b[k] := a[i] end end;
writeln(pos,' ',neg); for i := 1 to k do write(b[i],' ') end.
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
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку