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
ответ:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var
Chislo, Count, Summa, n: integer;
begin
Summa := 0;
Count := 0;
readln(Chislo);
while Chislo > 0 do
begin
n := Chislo mod 10;
if odd(n) then
begin
Summa := Summa + n;
inc(Count);
end;
Chislo := Chislo div 10;
end;
writeln('Сумма нечетных цифр числа: ', Summa);
writeln('Кол-во нечетных цифр числа: ', Count);
writeln('Среднее арифметическое нечетных цифр: ', Summa / Count);
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