Sub abcd() Dim n As Integer, a(1 To 8) As Integer Dim r As Range n = 8 imax = 1 Set r = Range(Cells(1, 1), Cells(2, 8)) r.ClearContents 'Очистка области r.Interior.Color = RGB(255, 255, 255) 'Очистка цвета заливки For i = 1 To n a(i) = Int(30 * Rnd) If a(i) > a(imax) Then imax = i Cells(1, i) = a(i) Next t = a(imax) Cells(1, imax).Interior.Color = RGB(204, 255, 255) Range(Cells(1, 1), Cells(1, imax - 1)).Interior.Color = RGB(255, 255, 153) For i = imax - 1 To 1 Step -1 a(i + 1) = a(i) Next a(1) = t For i = 1 To n Cells(2, i) = a(i) Next Cells(2, 1).Interior.Color = RGB(204, 255, 255) Range(Cells(2, 2), Cells(2, imax)).Interior.Color = RGB(255, 255, 153) End Sub
Var St: string; z:string[10]; x:string[2]; i,j,k,m: integer; //новые переменные Begin Write('введите строку текста - St'); Readln(St); k:=0; //обнуляем на всякий случай z:='0123456789'; i:=1; for j:=1 to length(St) do //начало begin; for m:=1 to 10 do if St[j]=z[m] then inc(k); end; if k=0 then begin; writeln('в тексте нет цифр'); exit; end; //конец while i<=length(st)-1 do begin x:=copy(st,I,2); if (x[1]=x[2]) and (pos(x[1],z)<>0) then begin delete(st,i,2); insert('две',st,i); i:=i+1; end; i:=i+1; end; writeln('преобразованная строка ', st); End.
228
Объяснение:
E4₁₆ = 14×16¹ + 4×16⁰ = 224 + 4 = 228₁₀