Skip to content

Instantly share code, notes, and snippets.

@evjeny
Created September 24, 2017 06:11
Show Gist options
  • Save evjeny/4acf34a9bff2b870e5c60053962b1940 to your computer and use it in GitHub Desktop.
Save evjeny/4acf34a9bff2b870e5c60053962b1940 to your computer and use it in GitHub Desktop.
Task 1.6: 4
import java.util.Scanner;
/**
* Created by evjeny
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double a = scanner.nextDouble(), b = scanner.nextDouble();
if(a!=0) {
double d = Math.abs(b/a);
double min_d = d==0.0?0.0:-d;
if (a > 0) {
if (b <= 0) {
print("x<"+min_d+" or x>"+d);
} else {
print("any x");
}
} else {
if(b>=0) {
print(min_d+"<x<"+d);
} else {
print("no such x");
}
}
} else {
if(b>0) print("any x");
else print("no such x");
}
}
private static void print(Object todo) {
System.out.print(todo);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment