ببینید کجاش اشتباهه ...

سلام من این برنامه رو برای پیدا کردن عدد اول در یک محدوده که کاربر مشخص می کنه نوشتم . اما کار نمی کنه
می خوام ببینم اشکال در کجاست.
PHP:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    ListBox1: TListBox;
    Label3: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,d,i : integer ;
begin
d:=0;
a := StrToInt(edit1.Text);
b := StrToInt(edit2.Text);
for i:=a+1 to b-1 do
 begin
  for c:=1 to b do
   begin
      if (i mod c)=0 then d:=d+1;
   end;
  if d=2 then
      begin
       listbox1.Items.Add(inttostr(i));
      end;
 end;

end;



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

end.
 

جدیدترین ارسال ها

بالا