package testStudentCode;
//import java.util.Arrays;
import java.util.Scanner;
public class TestStudentCode {
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner scan = new Scanner(System.in);
System.out.print("a = ?");
// This method reads the number provided using keyboard
double a = scan.nextDouble();
System.out.print("b = ?");
double b = scan.nextDouble();
// Closing Scanner after the use
scan.close();
System.out.println(a + "x + (" + b + ") = 0");
if (a == 0) {
System.out.println("a = 0");
} else {
double x = - b / a;
System.out.println("x = " + x);
}
Объяснение:
как то так
package testStudentCode;
//import java.util.Arrays;
import java.util.Scanner;
public class TestStudentCode {
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner scan = new Scanner(System.in);
System.out.print("a = ?");
// This method reads the number provided using keyboard
double a = scan.nextDouble();
System.out.print("b = ?");
double b = scan.nextDouble();
// Closing Scanner after the use
scan.close();
System.out.println(a + "x + (" + b + ") = 0");
if (a == 0) {
System.out.println("a = 0");
} else {
double x = - b / a;
System.out.println("x = " + x);
}
}
}
Объяснение:
как то так
package testStudentCode;
//import java.util.Arrays;
import java.util.Scanner;
public class TestStudentCode {
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner scan = new Scanner(System.in);
System.out.print("a = ?");
// This method reads the number provided using keyboard
double a = scan.nextDouble();
System.out.print("b = ?");
double b = scan.nextDouble();
// Closing Scanner after the use
scan.close();
System.out.println(a + "x + (" + b + ") = 0");
if (a == 0) {
System.out.println("a = 0");
} else {
double x = - b / a;
System.out.println("x = " + x);
}
}
}
Объяснение:
как то так