- Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbegin40.java
25 lines (23 loc) · 779 Bytes
/
begin40.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
importjava.util.Scanner;
publicclassbegin40 {
publicstaticvoidmain(String[] args) {
inta1, a2, b1, b2, c1, c2, d, x, y;
Scannerscanner = newScanner(System.in);
//a1=4, a2=2, b1=6,b2=3 ,c1=5, c2=7
a1 = scanner.nextInt();
a2 = scanner.nextInt();
b1 = scanner.nextInt();
b2 = scanner.nextInt();
c1 = scanner.nextInt();
c2 = scanner.nextInt();
d = ((a1 * b2) - (a2 * b1));//d=0
if (d != 0) {
x = ((c1 * b2) - (c2 * b1)) / d;//x=-15
y = ((a1 * c2) - (a2 * c1)) / d;//y=8
System.out.printf("x=%d \n",x);
System.out.printf("y=%d \n",y);
}else {
System.out.println("Tenglama Yechimga ega emas !");
}
}
}