From 12eb54d29d98d2fdb58a8d7e2934494a6f54d6c0 Mon Sep 17 00:00:00 2001 From: Tony-91 <73248515+Tony-91@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:23:02 -0800 Subject: [PATCH 1/9] added LCM program file --- lcmProgram | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lcmProgram diff --git a/lcmProgram b/lcmProgram new file mode 100644 index 0000000..e69de29 From 04ad9cc4879bca7f4b21eebc12a608593426d1e7 Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:24:57 -0800 Subject: [PATCH 2/9] Delete lcmProgram --- lcmProgram | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lcmProgram diff --git a/lcmProgram b/lcmProgram deleted file mode 100644 index e69de29..0000000 From 5e945ff1a8a265aca07cf0d33f6985b442be419f Mon Sep 17 00:00:00 2001 From: Tony-91 <73248515+Tony-91@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:47:04 -0800 Subject: [PATCH 3/9] text.txt --- lcmProgram/text.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lcmProgram/text.txt diff --git a/lcmProgram/text.txt b/lcmProgram/text.txt new file mode 100644 index 0000000..e69de29 From 121acaeab47b730a5e8307c80e56b6c6d126044b Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:56:21 -0800 Subject: [PATCH 4/9] Add files via upload --- lcmProgram/Main.java | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lcmProgram/Main.java diff --git a/lcmProgram/Main.java b/lcmProgram/Main.java new file mode 100644 index 0000000..98b9263 --- /dev/null +++ b/lcmProgram/Main.java @@ -0,0 +1,46 @@ +import java.util.Scanner; +public class Main { + public static void main(String[] args) { + /* Lowest Common Multiple : smallest number that is divisible by two numbers. + * + * EXAMPLE : 18 and 36 + * 2 * 3 * 3 = 18 + * 2 * 2 * 3 * 3 = 36 + * common factors = 2 * 2 * 3 * 3 = 36 + * LCM = 36 + * */ + + // Declare two integer variables to store input values + int number1; + int number2; + + // Create a Scanner object to read input from user + Scanner scan = new Scanner(System.in); + + // Prompt user to enter first number and read input + System.out.println("Enter first number : "); + number1 = scan.nextInt(); + + // Prompt user to enter second number and read input + System.out.println("Enter second number : "); + number2 = scan.nextInt(); + + // Initialize lcm variable to the maximum of the two input numbers + int lcm = Math.max(number1, number2); + + // Loop until the LCM is found + while (true) { + // Check if lcm is divisible by both numbers + if (lcm % number1 == 0 && lcm % number2 == 0) { + // If lcm is found, print it and exit the loop + System.out.println("LCM = "+ lcm); + break; + } + // If lcm is not found, increment it and continue looping + ++lcm; + } + + + + } +} \ No newline at end of file From 2b7a313e0ca33a3118306b6d4d6a7d3e6c30b31f Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:19:12 -0800 Subject: [PATCH 5/9] Create test --- lcmProgram/README.md/test | 1 + 1 file changed, 1 insertion(+) create mode 100644 lcmProgram/README.md/test diff --git a/lcmProgram/README.md/test b/lcmProgram/README.md/test new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/lcmProgram/README.md/test @@ -0,0 +1 @@ +test From 23b558d33948fd663ec8e7234374a12245e684a6 Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:19:26 -0800 Subject: [PATCH 6/9] Delete test --- lcmProgram/README.md/test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 lcmProgram/README.md/test diff --git a/lcmProgram/README.md/test b/lcmProgram/README.md/test deleted file mode 100644 index 9daeafb..0000000 --- a/lcmProgram/README.md/test +++ /dev/null @@ -1 +0,0 @@ -test From 4c2929cc2ba9362ce510d7f6c31c16789e8278e9 Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:22:46 -0800 Subject: [PATCH 7/9] Create README.md --- lcmProgram/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 lcmProgram/README.md diff --git a/lcmProgram/README.md b/lcmProgram/README.md new file mode 100644 index 0000000..e8949dd --- /dev/null +++ b/lcmProgram/README.md @@ -0,0 +1 @@ +Helpful links From b53079aef1e2a9cd8d4c04e6136fdf9a9c1e7d0a Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:33:48 -0800 Subject: [PATCH 8/9] Update README.md --- lcmProgram/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lcmProgram/README.md b/lcmProgram/README.md index e8949dd..6fc0136 100644 --- a/lcmProgram/README.md +++ b/lcmProgram/README.md @@ -1 +1,8 @@ -Helpful links +# Helpful Links + +## [How to Execute and Run Java Code from the Terminal](https://www.freecodecamp.org/news/how-to-execute-and-run-java-code/) + +## [Lowest Common Multiple refresher](https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-expressions-and-variables/cc-6th-lcm/a/least-common-multiple-review) + +## [The **Math.max()** method in Java](https://www.geeksforgeeks.org/java-math-max-method-examples/) + From 14967594eaffda35500de7fbf75ab14c6e38633e Mon Sep 17 00:00:00 2001 From: Tony <73248515+Tony-91@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:34:39 -0800 Subject: [PATCH 9/9] Delete text.txt --- lcmProgram/text.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lcmProgram/text.txt diff --git a/lcmProgram/text.txt b/lcmProgram/text.txt deleted file mode 100644 index e69de29..0000000