function GetAmount(AAmount: Currency): Currency; begin if AAmount < 100 then begin Result := 10; Exit; end; Result := 10 + Amount div 100 * 5; end;
procedure GetPrice(input:integer;var iSellPrice,iIntrPrice:integer); var i:integer; All:integer; begin All:=input; iIntrPrice:=10; while All>100 do begin inc(iIntrPrice,5); inc(All,-100); end; iSellPrice:=input-iIntrPrice; end;procedure TForm1.Button1Click(Sender: TObject); var i1,i2:integer; begin GetPrice(StrToInt(Edit1.Text),i1,i2); Label1.Caption:=IntToStr(i1); Label2.Caption:=IntToStr(i2); end;
begin
if AAmount < 100 then
begin
Result := 10;
Exit;
end;
Result := 10 + Amount div 100 * 5;
end;
var
i:integer;
All:integer;
begin
All:=input;
iIntrPrice:=10;
while All>100 do
begin
inc(iIntrPrice,5);
inc(All,-100);
end;
iSellPrice:=input-iIntrPrice;
end;procedure TForm1.Button1Click(Sender: TObject);
var
i1,i2:integer;
begin
GetPrice(StrToInt(Edit1.Text),i1,i2);
Label1.Caption:=IntToStr(i1);
Label2.Caption:=IntToStr(i2);
end;