Program bil_prima;
uses crt;
var
a,b,c,x : integer;
BEGIN
clrscr;
write('Masukan Bilangan Prima sampai : '); readln(x);
for a:= 1 to x do
Begin;
c:=0;
for b:=1 to a do
Begin;
if a mod b=0 then
c:=c+1;
end;
if c=2 then
begin;
write(a,' ');
write('');
end;
end;
readln;
END.
END.
FAKULTAS TEKNIK - UNIVERSITAS MAJALENGKA
uses crt;
var
a,b,c,x : integer;
BEGIN
clrscr;
write('Masukan Bilangan Prima sampai : '); readln(x);
for a:= 1 to x do
Begin;
c:=0;
for b:=1 to a do
Begin;
if a mod b=0 then
c:=c+1;
end;
if c=2 then
begin;
write(a,' ');
write('');
end;
end;
readln;
END.
END.
FAKULTAS TEKNIK - UNIVERSITAS MAJALENGKA
0 komentar:
Posting Komentar