Требуется нужно перевести программу из pascal в vba/ program num2; uses crt; var a : array [1..100] of integer; i,k,n, s : integer; begin clrscr; s: =0; write('k='); readln(k); write('n='); readln(n); for i: =1 to n do readln(a[i]); for i: =1 to n do if (a[i] mod k)=0 then s: =s+a[i]; writeln('s=',s); end. program num1; uses crt; var i, e : integer; begin clrscr; i: =0; write('e='); readln(e); while i begin i: =i+sqrt(2); end; writeln('i=',i); end. program num3; uses crt; var a, t : array [1..100, 1..100] of integer; i, j, x : integer; begin clrscr; for i: =1 to 100 do for j: =1 to 100 do a[i,j]: =random(10); for i: =1 to 100 do for j: =i+1 to 100 do t[i,j]: =a[i,j]; for i: =1 to 100 do for j: =1 to 100 do begin x: =0,5*((a[i,j]^2)+(a[i,j]^t[i,j])); writeln('x[',i,',',j,']=',x); end; end.
Sub num2()
s = 0
Dim A
k = CInt(InputBox("K ="))
n = CInt(InputBox("N ="))
Redim A(n - 1)
for i = 0 to n - 1
a(i) = CInt(InputBox("A(" & i & ") ="))
if a(i) MOD k = 0 then s = s + a(i)
next
MsgBox s
End Sub
Sub num1()
i = 0
e = CDbl(InputBox("E ="))
Do while i <= e
i = i + sqr(2)
Loop
MsgBox "i = " & i
End Sub