Hello Experts, I just wanna know how to display prime numbers in TListBox, If I put 10 in EditBox then it would display all the possible numbers fom 1 to 10,and will display to its according listbox.The even numbers in even_listbox, if prime it will display in prime_listbox and if it's odd then it will diplay in odd_Listbox.
Now I already got the even and odd numbers and displayed it to its according listboxes, however my problem is that I dont know how to display prime Numbers to its intended listbox.
Can you help me out of my problem? pls help me...
Your help is very much appreciated, thank you
Here's my current code by the way, (this is Delphi Programming Language and I'm using Lazarus version 1.2.4 as my IDE)
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
if (Edit1.Text='') then
ShowMessage('Input Field Required!')
else
for i:=1 to StrToInt(Edit1.Text) do
begin
if Odd(i) then
ListBox3.Items.Add(IntToStr(i))
else if (i mod 2)=0 then
ListBox2.Items.Add(IntToStr(i))
Button1.Enabled:=false;
Button2.Enabled:=true;
end;
end;
ListBox1 is for Prime
ListBox2 is for Even and
ListBox3 is for Odd
Button1 is "View"
Edit1.Text is an EditBox wherein, I input a particular number to be displayed in it's according Listboxes.