diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/com/company/Main.java b/src/com/company/Main.java
index bf033be..e15945f 100644
--- a/src/com/company/Main.java
+++ b/src/com/company/Main.java
@@ -4,22 +4,17 @@ import java.util.Scanner;
public class Main {
- public static void main(String args[]) {
+ public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
- System.out.println("Input the number:");
+ System.out.println("Input an integer to be factored:");
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));
+ for (int i = 1; i < (.5*a); i++) {
+ if (i <= a / i) {
+ if (a % i == 0) {
+ System.out.println("" + i + ", " + (a / i) + ". Sum: " + (i + (a / i)) + ". Difference: " + ((a / i) - i));
}
}
}