PROGRAM
cekprima;
var
i,j :
integer
;cek:
boolean
;
begin
while
not
eof
do
begin
readln(i);
cek:=
true
;
if
i<
2
then
cek:=
false
;
for
j:=
2
to
i-
1
do
begin
if
i
mod
j=
0
then
begin
cek:=
false
; break;
end
;
end
;
if
cek=
true
then
writeln
(
'YA'
)
else
writeln
(
'TIDAK'
);
end
;
readln
end
.
maaf tapi solusi di atas masih wrong answer. Tolong diperbaiki ya gan..
BalasHapusCek repository saya: github.com/andraantariksa/code-exercise
Hapus