Quote (xGurke @ 25 Jan 2011 08:54)
unit Unit10;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm10 = class(TForm)
Edit1: TEdit;
Button1: TButton;
ListBox1: TListBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form10: TForm10;
implementation
{$R *.dfm}
procedure TForm10.Button1Click(Sender: TObject);
var i, szam : longword;
begin
listbox1.Clear;
szam:=strtoint(edit1.text);
i:=2;
while i<= szam do
if szam mod i=0 then
begin
listbox1.Items.add(inttostr(i));
szam:= szam div i;
end
else inc(i);
end;
procedure TForm10.Button2Click(Sender: TObject);
var szam, i : longword;
begin
szam := strtoint(edit1.text);
i:=2;
if (szam mod i) = 0 then ShowMessage('Nem prím')
else
begin
while szam >i*i do
begin
if szam mod i = 0 then
begin
ShowMessage('Nem prím') ;
inc(i,2);
end;
end;
end;
end;
end.
menniyt kellet nekem is ilyen buziságokkal baszkódnom