Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner scan = new Scanner(System.in);
  8.         float a = scan.nextFloat(), b = scan.nextFloat();
  9.         if (a <= 0 && b <= 0)
  10.             System.out.print("no such x");
  11.         else
  12.             {
  13.                 float c = b/a;
  14.                 if (a >= 0 && b > 0)
  15.                 System.out.print("any x");
  16.                 else if (a > 0 && b < 0)
  17.                 System.out.print("x<" + String.format("%.1f",c) + " or " + "x>" + String.format("%.1f",-c));
  18.                 else if (a < 0 && b > 0)
  19.                 System.out.print(String.format("%.1f",c) + "<x<" + String.format("%.1f",-c));
  20.             }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement