Posted on Leave a comment

If 0 then print 0 else 1

[code language=”delphi”]
procedure TForm1.Button1Click(Sender: TObject);
var
a, b: integer;
begin
a := strtoint(Edit1.Text);
try
try
b := a div a;
except
on e: Exception do
b := 0;
end;
finally
Edit3.Text := inttostr(b);
end;
end;
[/code]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.