unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ScrollBar1: TScrollBar;
ScrollBar2: TScrollBar;
procedure Button1Click(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure ScrollBar2Change(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function kgv(z1,z2 : integer) : integer;
var
i, sum : integer;
ergebnis: boolean;
begin
i := 1;
repeat
ergebnis:= false;
sum:= z1*1;
i:=i+1;
if(sum
mod z2 = 0 )
then
ergebnis := true;
until ergebnis = true;
result := sum;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
label1.caption:= inttostr (scrollbar1.position);
end;
procedure TForm1.ScrollBar2Change(Sender: TObject);
begin
label2.caption:= inttostr (scrollbar2.position);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
x,x1,erg :integer;
begin
x := scrollbar1.position;
x1:= scrollbar2.position;
erg:=kgv (x,x1);
label3.caption:= inttostr(erg);
end;
end.