summaryrefslogtreecommitdiff
path: root/comp/work/41/exersise.py
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-01-30 12:49:01 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-01-30 12:49:01 +0000
commit02653ab40d93fb7e6d07edb747fe0e07c5d60c74 (patch)
tree12e62d9e66737597e2d7ddc71eefa8a08264cffa /comp/work/41/exersise.py
parent87c1e35223b0fd9002a6efca2a208fb8ae1993e2 (diff)
did many new things
Diffstat (limited to 'comp/work/41/exersise.py')
-rw-r--r--comp/work/41/exersise.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/comp/work/41/exersise.py b/comp/work/41/exersise.py
new file mode 100644
index 0000000..2633c4c
--- /dev/null
+++ b/comp/work/41/exersise.py
@@ -0,0 +1,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)