Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit2;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
- type
- TForm2 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- Button4: TButton;
- Button5: TButton;
- ListBox1: TListBox;
- ComboBox1: TComboBox;
- Button6: TButton;
- procedure FormCreate(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure Button6Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button5Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- procedure bersih;
- end;
- var
- Form2: TForm2;
- implementation
- {$R *.dfm}
- procedure TForm2.bersih;
- begin
- Edit1.Clear;
- Edit2.Clear;
- ComboBox1.Clear;
- ListBox1.Clear;
- end;
- procedure TForm2.Button1Click(Sender: TObject);
- var i:Integer;
- begin
- if Edit1.Text = '' then begin
- application.MessageBox('Datanya Masih Kosong'+#13+
- 'Silahkan Isikan dulu Datanya','Cek Pengisian...',MB_ICONWARNING);
- Edit1.SetFocus;
- EXIT;
- end;
- if Edit2.Text = '' then begin
- application.MessageBox('Batas Pengulangan Masih Kosong'+#13+
- 'Silahkan Isikan dulu Batas Pengulangannya','Cek Pengisian...',MB_ICONWARNING);
- Edit2.SetFocus;
- EXIT;
- end;
- if (Edit1.Text <> '') And (Edit2.Text <> '') then begin
- ComboBox1.Clear;
- ListBox1.Clear;
- for i := StrToInt(Edit1.Text) to StrToInt(Edit2.Text) do begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i));
- end;
- End;
- end;
- procedure TForm2.Button3Click(Sender: TObject);
- var i,Sisa:Integer;
- begin
- if StrToInt(Edit1.Text) < StrToInt(Edit2.Text) then begin
- ComboBox1.Clear;
- ListBox1.Clear;
- for i := StrToInt(Edit1.Text) to StrToInt(Edit2.Text) do begin
- Sisa:=i mod 2;
- if sisa <> 0 then begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i));
- end;
- end;
- end;
- //List Dibawah Untuk Bilangan Ganjil Decrement
- if StrToInt(Edit1.Text) > StrToInt(Edit2.Text) then begin
- ComboBox1.Clear;
- ListBox1.Clear;
- for i := StrToInt(Edit1.Text) downto StrToInt(Edit2.Text) do begin
- Sisa:=i mod 2;
- if sisa <> 0 then begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i));
- end;
- end;
- end;
- end;
- procedure TForm2.Button4Click(Sender: TObject);
- var j,genap:Integer;
- begin
- //Genap Increment
- if StrToInt(Edit1.Text) < StrToInt(Edit2.Text) then begin
- genap:=0;
- ComboBox1.Clear;
- ListBox1.Clear;
- for j := StrToInt(Edit1.Text) to StrToInt(Edit2.Text) do begin
- genap:=j mod 2;
- if genap = 0 then begin
- ComboBox1.Items.Add(IntToStr(j));
- ListBox1.Items.Add(IntToStr(j));
- end;
- end;
- End;
- //Genap Decrement
- if StrToInt(Edit1.Text) > StrToInt(Edit2.Text) then begin
- genap:=0;
- ComboBox1.Clear;
- ListBox1.Clear;
- for j := StrToInt(Edit1.Text) downto StrToInt(Edit2.Text) do begin
- genap:=j mod 2;
- if genap = 0 then begin
- ComboBox1.Items.Add(IntToStr(j));
- ListBox1.Items.Add(IntToStr(j));
- end;
- end;
- End;
- end;
- procedure TForm2.Button5Click(Sender: TObject);
- var i, sisa2, sisa3, sisa5, sisa7 : Integer;
- begin
- //prima increment
- if StrToInt(Edit1.Text)< StrToInt(Edit2.Text) then
- begin
- ComboBox1.Clear;
- ListBox1.clear;
- for i := StrToInt(Edit1.Text)to StrToInt(Edit2.Text) do
- begin
- if (i=2) or (i=3) or (i=5) or (i=7) then
- begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i))
- end;
- sisa2 := i mod 2;
- sisa3 := i mod 3;
- sisa5 := i mod 5;
- sisa7 := i mod 7;
- if (sisa2 <> 0) and (sisa3 <> 0) and (sisa5 <> 0) and (sisa7 <> 0) then
- begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i))
- end;
- end;
- end;
- //prima decrement
- if StrToInt(Edit1.Text)> StrToInt(Edit2.Text) then
- begin
- ComboBox1.Clear;
- ListBox1.clear;
- for i := StrToInt(Edit1.Text)downto StrToInt(Edit2.Text) do
- begin
- if (i=2) or (i=3) or (i=5) or (i=7) then
- begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i))
- end;
- sisa2 := i mod 2;
- sisa3 := i mod 3;
- sisa5 := i mod 5;
- sisa7 := i mod 7;
- if (sisa2 <> 0) and (sisa3 <> 0) and (sisa5 <> 0) and (sisa7 <> 0) then
- begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i))
- end;
- end;
- end;
- end;
- procedure TForm2.Button6Click(Sender: TObject);
- begin
- bersih;
- end;
- procedure TForm2.FormCreate(Sender: TObject);
- Var i : Int64;
- begin
- bersih;
- end;
- procedure TForm2.Button2Click(Sender: TObject);
- var i:Integer;
- begin
- if Edit1.Text = '' then begin
- application.MessageBox('Datanya Masih Kosong'+#13+
- 'Silahkan Isikan dulu Datanya','Cek Pengisian...',MB_ICONWARNING);
- Edit1.SetFocus;
- EXIT;
- end;
- if Edit2.Text = '' then begin
- application.MessageBox('Batas Pengulangan Masih Kosong'+#13+
- 'Silahkan Isikan dulu Batas Pengulangannya','Cek Pengisian...',MB_ICONWARNING);
- Edit2.SetFocus;
- EXIT;
- end;
- if (Edit1.Text <> '') And (Edit2.Text <> '') then begin
- ComboBox1.Clear;
- ListBox1.Clear;
- for i := StrToInt(Edit1.Text) to StrToInt(Edit2.Text) do begin
- ComboBox1.Items.Add(IntToStr(i));
- ListBox1.Items.Add(IntToStr(i)+''+IntToStr(i+1));
- end;
- End;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement