-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmukemmel.py
More file actions
31 lines (30 loc) · 754 Bytes
/
mukemmel.py
File metadata and controls
31 lines (30 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def mukemmel(sayi):
i = 1
global liste
liste = []
global mukemmelliste
mukemmelliste = []
while i < sayi:
if sayi % i == 0:
liste.append(i)
i = i + 1
else:
i = i + 1
#print("Bölenler Listesi: ",liste)
toplam = 0
for bolen in liste:
toplam = toplam +bolen
if toplam == sayi:
mukemmelliste.append(sayi)
if len(mukemmelliste) > 0:
print(sayi)
sayimiz = int(input("Lütfen bir sayi giriniz: "))
"""
mukemmel(sayimiz)
if len(mukemmelliste) == 0:
print(sayimiz,"mükemmel sayı değildir.")
else:
print(sayimiz, "mükemmel bir sayıdır.")
"""
for sayi in list(range(1,sayimiz)):
mukemmel(sayi)