close
語法:
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,r,m,n,temp:integer;
begin
a:=strtoint(edit1.text);
b:=strtoint(edit3.text)-strtoint(edit2.text);
if b mod a =0 then label4.caption:=floattostr(b/a)
else
begin
m:=abs(a);
n:=abs(b);
temp:=0;
r:=n mod m;
while r 0 do
begin
temp:=n;
n:=m;
m:=r;
r:=n mod m;
end;
if b/a else
label4.caption:=inttostr(temp)+'/'+inttostr(n);
end;
end;
全站熱搜
留言列表