Type mas = array[1..8] of integer; var A, F, Q: mas; C:array[1..8] of real; i: integer; function M(x,y:real):real; begin Result:=(x*x+y*x)/2+sin(x*y) end; begin clrscr; writeln('Массив первый:'); for i := 1 to 8 do begin A[i] := random(10); write(A[i]:4); end; writeln; writeln('Массив второй :'); for i := 1 to 8 do begin F[i] := random(10) ; write(F[i]:4); end; writeln; writeln('Массив третий :'); for i := 1 to 8 do begin Q[i] := random(10); write(Q[i]:4); end; writeln; writeln('Массив четвертый:'); for i := 1 to 8 do begin C[i] := M(A[i],F[i])+M(Q[i],F[i])+M(A[i],Q[i]); write(C[i]:6:1); end; writeln; end.
Sub Z() Dim k As Integer Dim m As Integer Dim p As Single Dim i As Integer Dim j As Integer Dim n As Integer Dim x As Integer k = InputBox("Количество округов") m = InputBox("Количество партий") p = InputBox("Порог явки изберателей (в %)") s = "Выборы состоялись в округах: " For i = 1 To k For j = 1 To m x = InputBox("Округ " & i & ". Голосов за партию №" & j) n = n + x Next j x = InputBox("Округ " & i & ". Не голосовало") If (n / (n + x) * 100) > p Then s = s & i & "; " n = 0 Next i MsgBox (s) End Sub
var
A, F, Q: mas;
C:array[1..8] of real;
i: integer;
function M(x,y:real):real;
begin
Result:=(x*x+y*x)/2+sin(x*y)
end;
begin
clrscr;
writeln('Массив первый:');
for i := 1 to 8 do
begin
A[i] := random(10);
write(A[i]:4);
end;
writeln;
writeln('Массив второй :');
for i := 1 to 8 do
begin
F[i] := random(10) ;
write(F[i]:4);
end;
writeln;
writeln('Массив третий :');
for i := 1 to 8 do
begin
Q[i] := random(10);
write(Q[i]:4);
end;
writeln;
writeln('Массив четвертый:');
for i := 1 to 8 do
begin
C[i] := M(A[i],F[i])+M(Q[i],F[i])+M(A[i],Q[i]);
write(C[i]:6:1);
end;
writeln;
end.
Dim k As Integer
Dim m As Integer
Dim p As Single
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim x As Integer
k = InputBox("Количество округов")
m = InputBox("Количество партий")
p = InputBox("Порог явки изберателей (в %)")
s = "Выборы состоялись в округах: "
For i = 1 To k
For j = 1 To m
x = InputBox("Округ " & i & ". Голосов за партию №" & j)
n = n + x
Next j
x = InputBox("Округ " & i & ". Не голосовало")
If (n / (n + x) * 100) > p Then s = s & i & "; "
n = 0
Next i
MsgBox (s)
End Sub