program bilprima;
uses wincrt;
function factor (n:longint) : longint;
var
i, temp : longint;
begin
temp :=0;
for i := 1 to n do
if n mod i=0
then inc(temp);
factor:=temp;
end;
var x, a, b, n :
longint;
begin
clrscr;
gotoxy(30,4);
writeln('Deret bilangan prima');
gotoxy(30,5);
writeln('====================');
gotoxy(3,70);
writeln('jumlah bilangan yang mau ditampilkan : ');
repeat
gotoxy(45,7);
clrEol;
readln(a);
until (a>=2);
gotoxy(3,9); writeln('Deret bilangan prima :
');
b :=1;
x :=0;
repeat
if factor(b) = 2
then
begin
write(b,', ');
write(#8);
{backspace}
inc(x);
end;
inc(b);
until (x=a);
readln;
end.
Tidak ada komentar:
Posting Komentar
Semoga Bermanfaat