From 7559e36254a430ac047a53f176a2391cc62e9232 Mon Sep 17 00:00:00 2001 From: fires Date: Sun, 5 Nov 2023 19:56:41 -0800 Subject: [PATCH] Finished assigment 007 --- .idea/misc.xml | 2 +- src/MyMath.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d15472f..433a737 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..5e6aa00 100644 --- a/src/MyMath.java +++ b/src/MyMath.java @@ -1,7 +1,24 @@ import java.util.Scanner; public class MyMath { + public static void gcf() { + Scanner s = new Scanner(System.in); + int a = s.nextInt(); + int b = s.nextInt(); + while (a != b) { + if (a > b) { + a %= b; + System.out.print(b); + break; + } else { + a %= b; + System.out.print(a); + break; + } + } + } public static void main(String[] args) { + gcf(); } }