#6 java pactice exmaple of variables

Test your skills – Example3



As we saw above, we used the ‘/’ to work out the quotient of var1 by 2. Given that ‘+’ would perform addition, ‘-‘ subtraction and ‘*’ multiplication, write out a program which performs all the named operations by using two integer values which are hard coded into the program

Hints:

 You need only two variables of type integer
 Make one variable larger and divisible by the other
 You can perform the required calculations directly in the print statements, remember to enclose the      operation within brackets, e.g. (var1-var2)

Comments

Popular Posts