Multiple operations and precedences Learn programming Java

Lesson:

First contact with Java


Exercise:

Multiple operations and precedences 17


Objetive:

Create a java program to print the result of the following operations:
-1 + 3 * 5
(24 +5 ) % 7
15 + -4 * 6 / 11
2 + 10 / 6 * 1 - 7 % 2


Code:

public class Main
{
	public static void main(String[] args)
	{
		System.out.println((-1 + 3) * 5);
		System.out.println((24 + 5) % 7);
		System.out.println(((15 + -4) * 6) / 11);
		System.out.println((((2 + 10) / (6 * 1)) - 7) % 2);
	}
}