uses crt;
label erika;
var
e,s : longint;
begin
clrscr;
write ('Masukkan Bilangan [1 - 2 milyar] :');
readln (e);
if e <= 1 then
begin
write ('Bukan Bilangan Prima');
goto erika;
end;
s := 2;
repeat
if (e mod s = 0) and (e <> 2) then
begin
write ('Bukan bilangan prima');
goto erika;
end;
s := s + 1;
until ( s >= e div 2);
write ('Bilangan Prima');
erika:
readln;
end.
Outputnya seperti ini :
No comments:
Post a Comment