java <= not working correctly -
{ system.out.println("please enter cost: "); cost1 = input.nextdouble(); } while (cost1 <= 100000 || cost1 >= 900000);
that's code. if enter 100001 skips loop, if put 100000 not. why this?
wrong condition (based on expect it)
cost1 <= 100000 || cost1 >= 900000
means
while cost1 <= 100k or cost1 >=900k
so when put 100001
neither less equal 100k
nor greater equal 900k
Comments
Post a Comment