Program Bilangan_Prima_Array;
Uses
wincrt;
Var
Prima :Array[1..100] of Integer;
i,j : Integer;
bilangan,Bil1,Bil2 : Integer;
Begin
repeat
ClrScr;
write('Inputkan Bilangan Awal:');
readln(Bil1);
write('Inputkan Bilangan Akhir:');
readln(Bil2);
For i := Bil1 to Bil2 Do
Begin
Prima[i]:=i;
For j:= 2 to i-1 Do
Begin
bilangan := (i mod j);
If bilangan = 0 then Prima[i]:=0;
End;
If Prima[i] <> 0 Then Write(Prima[i],' ');
End;
Readln;
Until Keypressed;
End.
Tidak ada komentar:
Posting Komentar