Ver Mensaje Individual
  #12  
Antiguo 02-04-2017
Daniel2622 Daniel2622 is offline
Miembro
NULL
 
Registrado: abr 2017
Posts: 29
Reputación: 0
Daniel2622 Va por buen camino
Perdón, este es todo mi código; esta construido en el programa Lazarus

Código Delphi [-]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  Buttons;

type

  { TForm1 }

  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }
Procedure cantidad_de_divisores(n:Integer);
var
  vNumero, vI, vCantidad: Integer;
begin
  vCantidad := 0;
  vNumero := StrToInt(Edit1.Text);

  for vI := 1 to vNumero do
    if (vNumero mod vI) = 0 then
      vCantidad := vCantidad + 1;

  Result := vCantidad;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
  n:Integer;
  codigo:Integer;
begin
  val(Edit1.Text,n,codigo);
  cantidad_de_divisores(n);
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
  Edit1.Clear;Edit2.Clear;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
  Close;
end;

end.
Responder Con Cita