-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCar_Choice.java
More file actions
37 lines (35 loc) · 835 Bytes
/
Car_Choice.java
File metadata and controls
37 lines (35 loc) · 835 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Scanner;
class cars{
public static void main(String args[]){
Scanner s=new Scanner(System.in);
int t=s.nextInt();
int i=0;
while(i<t){
float x1=s.nextFloat();
float x2=s.nextFloat();
float y1=s.nextFloat();
float y2=s.nextFloat();
double c1;
double c2;
c1=(y1/x1);
c2=(y2/x2);
/* System.out.println(y1);
System.out.println(x1);
System.out.println(y2);
System.out.println(x2);*/
if(c2<c1){
System.out.println("1");
}
else if(c1==c2){
System.out.println("0");
}
else if(c2>c1){
System.out.println("-1");
}
else{
break;
}
i++;
}
}
}