summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py
diff options
context:
space:
mode:
Diffstat (limited to 'AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py')
-rw-r--r--AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py b/AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py
new file mode 100644
index 0000000..5369b9e
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py
@@ -0,0 +1,17 @@
+# Uses python3
+def getNumOfCoins(m):
+ # coins with denominations of 1, 5, and 10
+ coinCount = 0
+ remainder = 0
+ if m / 10 == 0 & m % 10 == 0:
+ return m / 10
+ coinCount = coinCount + int(m / 10)
+ remainder = m % 10
+ if remainder >= 5:
+ return coinCount + 1 + remainder - 5
+ else:
+ return coinCount + remainder
+
+
+m = int(input())
+print(getNumOfCoins(m)) \ No newline at end of file