Last active
January 17, 2020 22:33
-
-
Save Zelakolase/d16ede57593aca94701a8be67abb2beb to your computer and use it in GitHub Desktop.
Java code to solve Quadratic Trinomials by Factorization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HelloWorld{ | |
// formula: x^2+dx+c, You gonna input d and c | |
public static void main(String []args){ | |
double b=1; | |
double c=12; | |
double d=-8; | |
for(double a=-2147483647;a<2147483647;a++) { | |
if(a==0) { | |
a++; | |
} | |
b=c/a; | |
if(b+a==d) { | |
if (a*b==c) { | |
result(a,b); | |
}else {} | |
}else {} | |
} | |
} | |
public static void result(double x,double y) { | |
System.out.println("x^2+"+x+"x+"+y); | |
System.out.println("(x+"+x+")(x+"+y+")"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment