From 7ae190b156be7384dbafbed8d6c8ceabe5d736a2 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 14 Dec 2021 21:45:47 -0600 Subject: [PATCH] Initial commit Works, but not perfectly. --- .idea/.gitignore | 3 +++ .idea/description.html | 1 + .idea/encodings.xml | 6 ++++++ .idea/misc.xml | 12 ++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/project-template.xml | 3 +++ .idea/runConfigurations.xml | 10 ++++++++++ FactorFinder.iml | 11 +++++++++++ src/com/company/Main.java | 27 +++++++++++++++++++++++++++ 9 files changed, 81 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/description.html create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/project-template.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 FactorFinder.iml create mode 100644 src/com/company/Main.java diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/description.html b/.idea/description.html new file mode 100644 index 0000000..db5f129 --- /dev/null +++ b/.idea/description.html @@ -0,0 +1 @@ +Simple Java application that includes a class with main() method \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b5b16a9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1d99db6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/project-template.xml b/.idea/project-template.xml new file mode 100644 index 0000000..1f08b88 --- /dev/null +++ b/.idea/project-template.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/FactorFinder.iml b/FactorFinder.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/FactorFinder.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/company/Main.java b/src/com/company/Main.java new file mode 100644 index 0000000..bf033be --- /dev/null +++ b/src/com/company/Main.java @@ -0,0 +1,27 @@ +package com.company; + +import java.util.Scanner; + +public class Main { + + public static void main(String args[]) { + + Scanner scan = new Scanner(System.in); + + System.out.println("Input the number:"); + System.out.println("Note: Must be positive. If negative, remove negative and make one factor negative"); + double a = scan.nextDouble(); + + for (int i = 1; i < (.5*a); i++){ + if (a%i == 0){ + System.out.print("" + i + ", " + (a/i) + ". Sum: " + (i + (a/i))); + //Adds difference (might not work, but not sure if that's because of bad online compiler) + if (i < a%i){ + System.out.println(". Difference: " + (i - (a/i))); + } else { + System.out.println(". Difference: " + ((a/i) - i)); + } + } + } + } +} \ No newline at end of file