From 1501de361ecc1c83d618165fc7cff2afe4808939 Mon Sep 17 00:00:00 2001 From: francoPalacios Date: Wed, 25 Oct 2023 10:45:05 -0700 Subject: [PATCH] done! --- .idea/misc.xml | 2 +- src/MyMath.java | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d15472f..3d0947f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/MyMath.java b/src/MyMath.java index 7da9a29..1c5550c 100644 --- a/src/MyMath.java +++ b/src/MyMath.java @@ -2,6 +2,27 @@ public class MyMath { + public static void gcf(){ + //2 inputs from user + System.out.println("enter dividend"); + Scanner input = new Scanner(System.in); + int a = input.nextInt(); + System.out.println("enter divisor"); + int b = input.nextInt(); + + + //gcf algorithm + while(b!=0){ + int c = b; + b = a % b; + a = c; + } + + System.out.println("the gcf is " + a); + } + public static void main(String[] args) { + gcf(); } + }