Question: 1. Create a Java program that declares and initializes two integer variables, num1 and num2, with values of your choice 2. Output the values of

1. Create a Java program that declares and initializes two integer variables, "num1" and "num2", with values of your choice

2. Output the values of "num1" and "num2" to the console using the System.out.println() method.

3. Use the addition operator (+) to add "num1" and "num2" together and output the result to the console.

4. Use the subtraction operator (-) to subtract "num2" from "num1" and output the result to the console.

5. Use the multiplication operator (*) to multiply "num1" and "num2" together and output the result to the console.

6. Use the division operator (/) to divide "num1" by "num2" and output the result to the console.

7. Use the modulus operator (%) to find the remainder when "num1" is divided by "num2" and output the result to the console.

8. Use the increment operator (++) to increment the value of "num1" by 1 and output the new value to the console.

9. Use the decrement operator (--) to decrement the value of "num2" by 1 and output the new value to the console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!