Var A:array[1..4] of integer; i,j,R,P:integer; function HOD(c,b:integer):integer; begin while c<>b do if c>b then c:=c-b else b:=b-c; HOD:=c; end; function HOK(c,b, RR:integer):integer; begin if ((c mod b=0) or (b mod c=0)) and ((c div b > 1) or (b div c > 1)) then begin if c>b then HoK:=c else HOK:=b; end else HOK:=(c*b) div RR; end; begin A[1]:=36; A[2]:=54; A[3]:=18; A[4]:=15; P:=1; R:=HOD(A[1],A[2]); P:=HOK(A[1], A[2], R); for i:=3 to 4 do begin R:=HOD(R, A[i]); P:=HOK(P, A[i],R); end; writeln('HOK = ',P); end.
Var A:array[1..4] of integer; i,j,R,P:integer; function HOD(c,b:integer):integer; begin while c<>b do if c>b then c:=c-b else b:=b-c; HOD:=c; end; function HOK(c,b, RR:integer):integer; begin if ((c mod b=0) or (b mod c=0)) and ((c div b > 1) or (b div c > 1)) then begin if c>b then HoK:=c else HOK:=b; end else HOK:=(c*b) div RR; end; begin A[1]:=36; A[2]:=54; A[3]:=18; A[4]:=15; P:=1; R:=HOD(A[1],A[2]); P:=HOK(A[1], A[2], R); for i:=3 to 4 do begin R:=HOD(R, A[i]); P:=HOK(P, A[i],R); end; writeln('HOK = ',P); end.
Объяснение:
x:= 5
y:=2
z:= -1
z:= z*4 (=1*-4=-4)
y:=y/2 (=2/2=1)
x:=x-1 (=5-1=4)
y:=x+y (=4+1=5)
x=4
y=5
z=-4