Fakultas Ilmu Komputer UI

Commit 74690c98 authored by Ruly Achmad Gemilang Gultom's avatar Ruly Achmad Gemilang Gultom
Browse files

trial second submission

parents
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
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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment