uses Crt; const n=10; type Mas=array [1..n] of integer; var A: Mas; i, temp, MinInd, MaxInd, Max, Min: integer; begin ClrScr; Randomize; for i:=1 to n do begin A[i]:=10+random(90); Write (A[i]:5); end; WriteLn; Max:=A[1]; MaxInd:=1; Min:=A[1]; MinInd:=1; for i:=2 to n do begin if A[i]<Min then begin Min:=A[i]; MinInd:=i; end else if A[i]>Max then begin Max:=A[i]; MaxInd:=i; end; end; temp:=A[MaxInd]; A[MaxInd]:=A[MinInd]; A[MinInd]:=temp; WriteLn;WriteLn; for i:=1 to n do Write (A[i]:5); WriteLn; ReadLn; end.
uses Crt; const n=10; type Mas=array [1..n] of integer; var A: Mas; i, temp, MinInd, MaxInd, Max, Min: integer; begin ClrScr; Randomize; for i:=1 to n do begin A[i]:=10+random(90); Write (A[i]:5); end; WriteLn; Max:=A[1]; MaxInd:=1; Min:=A[1]; MinInd:=1; for i:=2 to n do begin if A[i]<Min then begin Min:=A[i]; MinInd:=i; end else if A[i]>Max then begin Max:=A[i]; MaxInd:=i; end; end; temp:=A[MaxInd]; A[MaxInd]:=A[MinInd]; A[MinInd]:=temp; WriteLn;WriteLn; for i:=1 to n do Write (A[i]:5); WriteLn; ReadLn; end.
Объяснение:
a = int(input())
b = int(input())
c = int(input())
p = int(a + b + c)
s = int()# Нельзя найти из 3х сторон
print("P=", p)
print("S=", s)