Revisi :

 

Function is_prima(nilai) as boolean 

 If nilai > 2 and mod(nilai,2) = 0

  Is_prima=false

 elseIf nilai > 3 and mod(nilai,3) = 0

  Is_prima=false

elseIf nilai > 5 and mod(nilai,5) = 0 

  Is_prima=false

elseIf nilai > 7 and mod(nilai,7) = 0 

  Is_prima=false

 Else

  Is_prima=true

 endif

end function 

 

cara pakai :

 

if is_prima(nilai) = true then

  "bilangan prima"

Endif

 

 

________________________________

From: Rosadi, Edi 
Sent: Tuesday, May 27, 2008 3:56 PM
To: '[email protected]'
Subject: RE: [indoprog-vb] bilangan prima

 

Bilangan prima adalah bilangan yang tidak habis dibagi 2,3,5 (dengan
operator logika 'or')

 

Function is_prima(nilai) as boolean

 If mod(nilai,2) = 0

  Is_prima=false

 elseIf mod(nilai,3) = 0

  Is_prima=false 

 elseIf mod(nilai,5) = 0

  Is_prima=false

 Else

  Is_prima=true

 endif

end function 

 

cara pakai :

 

if is_prima(txtnilai.value) then

  "bilangan prima"

Endif

 

Lebih jelasnya silahkan diolah lagi.......

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of Achmad lukman
Sent: Tuesday, May 27, 2008 12:49 PM
To: [email protected]
Subject: [indoprog-vb] bilangan prima

 

dear all,

ada ga yang pernah buat rumus bilangan prima di VB ??
mohon bantuannya ya...

salam,
Lukman

---------------------------------
Yahoo! Toolbar kini dilengkapi dengan Search Assist. Download sekarang
juga.

[Non-text portions of this message have been removed]

 





NOTICE - This message and any attached files may contain information that is 
confidential and intended only for use by the intended recipient. If you are 
not the intended recipient or the person responsible for delivering the message 
to the intended recipient, be advised that you have received this message in 
error and that any dissemination, copying or use of this message or attachment 
is strictly forbidden, as is the disclosure of the information therein. If you 
have received this message in error please notify the sender immediately and 
delete the message.


[Non-text portions of this message have been removed]

Kirim email ke