1 import java.util.Scanner;
2 public class LinearEquation {
3 public static void main(String[] args){
4 double a, b, c, d, e, f, x, y;
5 System.out.println("Enter a, b, c, d, e, f");
6 Scanner input = new Scanner(System.in);
7 a = input.nextDouble();
8 b = input.nextDouble();
9 c = input.nextDouble();
10 d = input.nextDouble();
11 e = input.nextDouble();
12 f = input.nextDouble();
13 if((a*d)-(b*c) == 0){
14 System.out.println("The equation has no solution");
15 }
16 else{
17 x=((e*d)-(b*f))/((a*d)-(b*c));
18 y=((a*f)-(e*c))/((a*d)-(b*c));
19 System.out.println("x is " + x + " and y is " + y);
20 }
21 }
22 }