If 0 then print 0 else 1

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;

Leave a Reply

Your email address will not be published. Required fields are marked *