Script ini saya peroleh hasil eksperimen yang sudah berhhasil di launching :)
Hahaha, sebenarnya ini dulunya tugas. Tapi ngga papa, di publish ajja buat yang mau belajar !
Selamat bercoding ria !
PS: Coba di Copy - Paste dulu, trus di RUN. baru di analisa ya :))
--------------------------------------------------------------------------------------------
uses wincrt;
var n, x, sisa, bil, i : integer;
Label 1;
begin
writeln;
writeln;
writeln;
writeln(' _______________________________________________');
writeln(' ~| Program Menampilkan Bilangan Prima |~');
writeln(' _______________________________________________');
writeln;
writeln(' By: v3©2010');
writeln;
writeln;
writeln;
writeln;
writeln;
writeln;
writeln;
writeln('(Press any key to continue... )');
Readkey;
clrscr;
1:
Write('Masukkan rentang bilangan prima : ');
read(bil);
Writeln('yang termasuk bilangan prima dalam rentang tersebut adalah...');
writeln;
writeln;
Writeln('|----------|');
writeln ('| ',2,' |');
For i := 1 to bil do
begin
x := 2;
repeat
sisa := i mod x;
x := x +1;
until
(sisa = 0) or
(x = (i- 1));
begin
if i = (3) then
writeln ('|',i:4,' |')
else if sisa = 0 then
write ('')
else
writeln('|',i:4,' |');
end;
end;
Writeln('|----------|');
Writeln;
Writeln ('Press enter to repeat program');
readkey;
clrscr;
Goto 1;
end.
----------------------------------------------------------------------------
Any question?
ask me by comment or tweet me @v3biebs :)
Download Script dan Programnya di Program_BilPrima.rar
Tidak ada komentar:
Posting Komentar