Can someone explain to me why the result is 30?
System.out.println(30 - 12 / (2*5) +1);
Can someone explain to me why the result is 30?
System.out.println(30 - 12 / (2*5) +1);
This is simple arithmetic order of operations. 30 - 12 / (2 * 5) + 1 breaks down thus:
2 * 5 becomes 10. You now have 30 - 12 / 10 + 1.30 - 1 + 1.