Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ruly Achmad Gemilang Gultom
1906399915-DDP1
Commits
74690c98
Commit
74690c98
authored
Feb 14, 2020
by
Ruly Achmad Gemilang Gultom
Browse files
trial second submission
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
TP2_1_1906399915.py
0 → 100644
View file @
74690c98
angka
=
(
input
(
"masukkan angka: "
))
cek_angka
=
int
(
angka
)
pangkat
=
0
kelipatan_dua
=
True
while
cek_angka
!=
1
and
kelipatan_dua
:
if
cek_angka
%
2
==
1
:
kelipatan_dua
=
False
else
:
cek_angka
/=
2
pangkat
+=
1
else
:
if
kelipatan_dua
==
True
:
print
(
angka
,
"merupakan 2^"
,
pangkat
)
else
:
print
(
angka
,
"bukan bilangan pangkat"
)
\ No newline at end of file
TP2_2_1906399915.py
0 → 100644
View file @
74690c98
angka
=
int
(
input
(
"masukkan angka: "
))
pembagi
=
0
for
i
in
range
(
1
,
angka
+
1
):
if
angka
%
i
==
0
:
pembagi
+=
1
if
pembagi
==
2
and
angka
>
1
:
print
(
"bilangan ini prima"
)
else
:
print
(
"bilangan ini bukan prima"
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment