Slightly cleaner code

This commit is contained in:
blzimme000 2022-01-10 15:13:06 -06:00
parent d79f0ca19d
commit 6dfdf9ce76

View file

@ -22,10 +22,8 @@ public class Main {
public static String factor(double a){
String thingtoreturn = "";
for (int i = 1; i < (.5*a); i++) {
if (i <= a / i) {
if (a % i == 0) {
thingtoreturn += "" + i + ", " + (a / i) + ". Sum: " + (i + (a / i)) + ". Difference: " + ((a / i) - i) + "\n";
}
if (i <= a / i && a % i == 0) {
thingtoreturn += "" + i + ", " + (a / i) + ". Sum: " + (i + (a / i)) + ". Difference: " + ((a / i) - i) + "\n";
}
}
return thingtoreturn;