summaryrefslogtreecommitdiff
path: root/comp/work/41/exersise.py
blob: 2633c4c04d535037448f0cc471899f36e3bc0fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def getdigits(number):
        digits = []
        for i in number:
                digits.append(int(i))
        return digits

def testnumber(number):
	d = getdigits(number)
	total = sum(d)

	if (int(number) % total) == 0:
        	return True
	return False

n = int(input("which harshad number should you go to: "))

count = 0
i = 0
while count < n:
	i += 1
	if testnumber(str(i)):
                count += 1

print(i)