Check if a variable is between two numbers with Java

后端 未结 7 1981
暗喜
暗喜 2020-12-10 13:35

I have a problem with this code:

if (90 >>= angle =<< 180)

The error explanation is:

The left-hand side

7条回答
  •  眼角桃花
    2020-12-10 13:41

    //If "x" is between "a" and "b";
    
    .....
    
    int m = (a+b)/2;
    
    if(Math.abs(x-m) <= (Math.abs(a-m)))
    
    {
    (operations)
    }
    

    ......

    //have to use floating point conversions if the summ is not even;

    Simple example :

    //if x is between 10 and 20
    
    if(Math.abs(x-15)<=5)
    

提交回复
热议问题