Algoritma Untuk Menampilkan Bilangan Prima

Spesifikasi : { mencari bilangan genap dan ganjil,  batasan range nilai awal dan akhir dimasukkan dari keyboard. Menampilkan hasil  bilangan genap dan ganjil ke layar monitor}

Deklarasi (kamus) :

i, j, awal, akhir : int

prima: boolean

Diskripsi :

Read(“masukkan batas awal range”, awal)

Read (“masukkan batas akhir range” , akhir)

for i=awal to akhir do

if awal <akhir

then

if i==2

prima=true

for j=2 to j<=i do

if    i mod j == 0

prima=false

else

prima=true

end if

end if

end for

Write(“bilangan prima”, i)

About Sheilla Rizkia Ferianty

Semangat!

Posted on 03/12/2011, in Java and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: