Function ds(ByVal n As Integer) As Integer 'Сумма цифр в числе n Dim s As Integer s = 0 Do While n <> 0 s = s + n Mod 10 n = Int(n / 10) Loop ds = sEnd FunctionFunction IsGood(n As Integer) As Boolean 'Сохраняется ли сумма цифр при умножении числа на 2,3,..9 ? Dim etalon As Integer, k As Integer etalon = ds(n) IsGood = True k = 2 Do While IsGood And k < 10 IsGood = (ds(n * k) = etalon) k = k + 1 LoopEnd FunctionSub aaa() Dim i As Integer, s As String s = "" For i = 10 To 99 If IsGood(i) Then s = s + Str(i) Next i MsgBox sEnd Sub
Тестовое решение:18 45 90 99