Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Quadratic equation
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { double d,e,a,b,c; Scanner tx=new Scanner(System.in); System.out.println("Enter the coefficient of variable x²"); a=tx.nextDouble(); System.out.println("Enter the coefficient or variable x"); b=tx.nextDouble(); System.out.println("Enter the coefficient with no variable"); c=tx.nextDouble(); d=(-b+Math.sqrt(Math.pow(b,2)-4*a*c))/(2*a); e=(-b-Math.sqrt(Math.pow(b,2)-4*a*c))/(2*a); System.out.println("The value or x is "+d+" or "+e); } }
run
|
edit
|
history
|
help
1
Java Switch
Question FizzBuzz
JAVA regex for only allow numbers
heeeeell
Quadratic equation
f
jb12.0 threads.enums
Main.java
[Java] Coding - Reverse CODE - Mathematical Method
Multiplying Two Base-36 Numbers