М... заморила твоя задача однако Program asd; USES crt; var A:array [1..5] of integer; min,max,min2,o,p:real; i,n:integer;
Procedure max1; begin for i:=1 to 5 do if A[i]>0 then if min<A[i] then min:=A[i]; Writeln('Min: ',min); end; Procedure min1; begin for i:=1 to 5 do if A[i]<0 then if min>A[i] then min:=A[i]; Writeln('Min: ',min); end; BEGIN clrscr; For i:=1 to 5 do begin A[i]:=random(9)-5; Write(' ',A[i]); end; Writeln; //Otrizanie For i:=1 to 5 do if A[i]<0 then o:=o+A[i]; Writeln('Summa otrizatelnyx elementov: ',o); //Polowitelnye For i:=1 to 5 do if A[i]>0 then p:=p+A[i]; Writeln('Summa polowitelnyx elementov: ',p); if p<o then max1 else min1; END.
Randomize() Dim k As Integer Dim i As Integer i = Rnd() * 100 + 1 ReDim A(i) For k = 0 To i A(k) = Rnd() * -1000 + 500 Next
Dim intA, intB As Integer intA = InputBox("Введите начало интервала") intB = InputBox("Введите конец интервала") Dim R, Q, S As Integer R = 0 For i = 1 To UBound(A) If A(i) < A(R) Then R = i If A(i) Mod 2 <> 0 Then Q = Q + A(i) ' c2fbefeeebede8eb3a20caf3eff0e8ffedeee220c42ec52e2028632920442d6d6f6e3535 If A(i) > intA And A(i) < intB Then S = S + 1 Next
Program asd;
USES crt;
var
A:array [1..5] of integer;
min,max,min2,o,p:real;
i,n:integer;
Procedure max1;
begin
for i:=1 to 5 do
if A[i]>0 then
if min<A[i] then
min:=A[i];
Writeln('Min: ',min);
end;
Procedure min1;
begin
for i:=1 to 5 do
if A[i]<0 then
if min>A[i] then
min:=A[i];
Writeln('Min: ',min);
end;
BEGIN
clrscr;
For i:=1 to 5 do
begin
A[i]:=random(9)-5;
Write(' ',A[i]);
end;
Writeln;
//Otrizanie
For i:=1 to 5 do
if A[i]<0 then o:=o+A[i];
Writeln('Summa otrizatelnyx elementov: ',o);
//Polowitelnye
For i:=1 to 5 do
if A[i]>0 then p:=p+A[i];
Writeln('Summa polowitelnyx elementov: ',p);
if p<o then max1
else min1;
END.
Dim A() As Integer
Randomize()
Dim k As Integer
Dim i As Integer
i = Rnd() * 100 + 1
ReDim A(i)
For k = 0 To i
A(k) = Rnd() * -1000 + 500
Next
Dim intA, intB As Integer
intA = InputBox("Введите начало интервала")
intB = InputBox("Введите конец интервала")
Dim R, Q, S As Integer
R = 0
For i = 1 To UBound(A)
If A(i) < A(R) Then R = i
If A(i) Mod 2 <> 0 Then Q = Q + A(i)
' c2fbefeeebede8eb3a20caf3eff0e8ffedeee220c42ec52e2028632920442d6d6f6e3535
If A(i) > intA And A(i) < intB Then S = S + 1
Next
MsgBox("T=R/Q+1+S = " & A(R) / Q + 1 + S)