From fb8653a2ba91d05cbd46a4775daa7c8894f47253 Mon Sep 17 00:00:00 2001 From: kin Date: Thu, 24 Nov 2022 16:44:08 +0100 Subject: [PATCH] coderbyte challenge week10 --- week10/akinola/division.md | 2 ++ week10/akinola/division.py | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 week10/akinola/division.md create mode 100644 week10/akinola/division.py diff --git a/week10/akinola/division.md b/week10/akinola/division.md new file mode 100644 index 0000000..bac27c2 --- /dev/null +++ b/week10/akinola/division.md @@ -0,0 +1,2 @@ +Division +Have the function Division(num1,num2) take both parameters being passed and return the Greatest Common Factor. That is, return the greatest number that evenly goes into both numbers with no remainder. For example: 12 and 16 both are divisible by 1, 2, and 4 so the output should be 4. The range for both parameters will be from 1 to 10^3. \ No newline at end of file diff --git a/week10/akinola/division.py b/week10/akinola/division.py new file mode 100644 index 0000000..1cfd435 --- /dev/null +++ b/week10/akinola/division.py @@ -0,0 +1,10 @@ +def Division(num1,num2): + while num1 != 0 and num2 != 0: + if num1 > num2: + num1 = num1 % num2 + else: + num2 = num2 % num1 + return (num1 + num2) + +# keep this function call here +print Division(raw_input()) \ No newline at end of file