Ane ingin share contoh program yang ane buat yaitu program menampilkan bilangan prima dalam bahasa pascal berikut listing codenya :
program bilangan_prima;
uses crt;
var
i,j,k,l : byte;
begin
clrscr;
writeln ('masukkan nilai awal');readln (i);
writeln ('masukkan nilai akhir'); readln (j);
for k:=i+1 to j-1 do
begin
for l:=2 to k-1 do
begin
if (k mod l=0) then l:=k-1 else
if (k mod l<>0) and (l=k-1) then writeln (k);
end;
end;
readln;
end.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment