Module: (Java) Variables. Output formats


Problem

2/7

Almost Calculator

Theory Click to read/hide

Let's try to write a calculator for primes

Our task is to display some arithmetic expression on the screen and make the computer count it.
For example, this:
5 + 7 = 12
Moreover, instead of 5 and 7, there may be different numbers, depending on the values of the variables a and b in the program.

In the output operator, you can output not just text, but also the values of variables, as well as the result of an arithmetic expression. Moreover, the output sequence may be different.

For example, you can output the above expression by writing:

System.out.print(a+"+"+b+"="+(a+b));
If you want to output the value of a variable, then you just need to specify its name without quotes. If we want to output the result of an arithmetic expression, then it is enough to simply write the arithmetic expression correctly.


*** Advanced material***
The number of output specifiers in the format string is not limited, the main thing for each qualifier is to list all the values that will be substituted for the template after the format string, by comma.
For example: System.out.printf("%d+%d=%d",a,b,a+b);
The format string indicates three specifiers for displaying integer values instead. The substitution order is direct:  instead of the first template %d, the value of the variable a is displayed; instead of the second, the value of the variable b; and instead of the third, the value of the expression a + b

Now let's write a program that outputs the result of basic arithmetic operations with these variables

Problem

Complete the given program so that in addition to the sum of numbers it displays the substraction, product and division in the corresponding lines.
The result of each operation must be displayed on a new line.
Do not forget to go to the new line, where necessary.
You should get the following:
10+5=15
10-5=5
10*5=50
10/5=2