// PascalABC.NET 3.0, сборка 1144 от 16.01.2016 begin var n:=ReadInteger('n='); var a:=ArrRandom(n,1,50); a.Println; a.Where(x->x mod 7=0).Println end.
Решение на VBA: Sub zad1() Dim a(10) As Integer Dim otvet As String otvet = "Massiv: " Randomize For i = 0 To 10 a(i) = Fix(Rnd * 1000) otvet = otvet + "[" + CStr(a(i)) + "] " Next i otvet = otvet + vbCrLf + "kratno 7: " For i = 0 To 10 If a(i) Mod 7 = 0 Then otvet = otvet + "[" + CStr(a(i)) + "] " Next i MsgBox (otvet) End Sub
begin
var n:=ReadInteger('n=');
var a:=ArrRandom(n,1,50); a.Println;
a.Where(x->x mod 7=0).Println
end.
Тестовое решение:
n= 12
26 7 32 16 26 8 40 34 49 28 10 10
7 49 28
Sub zad1()
Dim a(10) As Integer
Dim otvet As String
otvet = "Massiv: "
Randomize
For i = 0 To 10
a(i) = Fix(Rnd * 1000)
otvet = otvet + "[" + CStr(a(i)) + "] "
Next i
otvet = otvet + vbCrLf + "kratno 7: "
For i = 0 To 10
If a(i) Mod 7 = 0 Then otvet = otvet + "[" + CStr(a(i)) + "] "
Next i
MsgBox (otvet)
End Sub
Результат: