title: I need to check if a number is equal,2x,3x,4x,5x greater than the other. How can i do this?
body: <p>Basically I just need this program to tell me that if a&gt;b and by how much.So the conditions I need to check are if a==b, a&gt;b,b&lt;a and also I need to know how many times greater, which ranges from 2x,3x,4x,5x,6x.For example if the number is greater than 6 times just print &quot;a lot bigger &quot;.
  If there is any other efficient way to do this then please give me suggestions.But the problem with this code is that it does not run fast the first condition of (a&gt;b||a/b&lt;1||a/b&gt;0)</p>
  <pre><code>import java.util.Scanner;
  </code></pre>
  <p>public class Main {</p>
  <pre><code>public static void main(String[] args) {
  
  
  
      Scanner input =new Scanner(System.in);
  
      System.out.println(&quot;what is the value for a&quot;);
      double a =input.nextDouble();
      System.out.println(&quot;what is the value for b&quot;);
      double b =input.nextDouble();
  
  
      if (a==b){
          System.out.println(&quot;a is equal to b&quot;);
      }
      else if (a&gt;b||a/b&lt;1||a/b&gt;0){
          System.out.println(&quot;a is slightly bigger than b&quot;);
  
      }
      else if (a&gt;b||a/b&lt;3||a/b&gt;=2) {
          System.out.println(&quot;a is 2x bigger than b&quot;);
      }
      else if (a&gt;b||a/b&lt;4||a/b&gt;=3) {
          System.out.println(&quot;a is 3x bigger than b&quot;);
      }
      else if (a&gt;b||a/b&lt;5||a/b&gt;=4) {
          System.out.println(&quot;a is 4x bigger than b&quot;);
      }
  
      else if (a&gt;b||a/b&lt;6||a/b&gt;=5) {
          System.out.println(&quot;a is 5x bigger than b&quot;);
      }
  
      else if (a&gt;b||a/b&lt;100||a/b&gt;6){
          System.out.println(&quot;a is alot bigger than b&quot;);
      }
      // to check if b is bigger than a
      else if (a&lt;b||b/a&lt;1||b/a&gt;0){
          System.out.println(&quot;b is slightly bigger than a&quot;);
  
      }
      else if (a&lt;b||b/a&lt;3||b/a&gt;=2) {
          System.out.println(&quot;b is 2x bigger than a&quot;);
      }
      else if (a&lt;b||b/a&lt;4||b/a&gt;=3) {
          System.out.println(&quot;b is 3x bigger than a&quot;);
      }
      else if (a&lt;b||b/a&lt;5||b/a&gt;=4) {
          System.out.println(&quot;b is 4x bigger than a&quot;);
      }
  
      else if (a&lt;b||b/a&lt;6||b/a&gt;=5) {
          System.out.println(&quot;b is 5x bigger than a&quot;);
      }
  </code></pre>
  <p>// to check if its alot bigger</p>
  <pre><code>    else if (a&gt;b||a/b&lt;100||a/b&gt;6){
          System.out.println(&quot;a is alot bigger than b&quot;);
  
  
  
      }
  
  
  
  }}
  </code></pre>