Create a Java program that declares and initializes two integer variables, "num1" and "num2", with values of your choice Output the values of "num1" and "num2" to the console using the System.out.println() method. Use the addition operator (+) to add "num1" and "num2" together and output the result to the console. Use the subtraction operator (-) to subtract "num2" from "num1" and output the result to the console. Use the multiplication operator (*) to multiply "num1" and "num2" together and output the result to the console. Use the division operator (/) to divide "num1" by "num2" and output the result to the console. Use the modulus operator (%) to find the remainder when "num1" is divided by "num2" and output the result to the console. Use the increment operator (++) to increment the value of "num1" by 1 and output the new value to the console. Use the decrement operator (--) to decrement the value of "num2" by 1 and output the new value to the console.
-
Create a Java program that declares and initializes two integer variables, "num1" and "num2", with values of your choice
-
Output the values of "num1" and "num2" to the console using the System.out.println() method.
-
Use the addition operator (+) to add "num1" and "num2" together and output the result to the console.
-
Use the subtraction operator (-) to subtract "num2" from "num1" and output the result to the console.
-
Use the multiplication operator (*) to multiply "num1" and "num2" together and output the result to the console.
-
Use the division operator (/) to divide "num1" by "num2" and output the result to the console.
-
Use the modulus operator (%) to find the remainder when "num1" is divided by "num2" and output the result to the console.
-
Use the increment operator (++) to increment the value of "num1" by 1 and output the new value to the console.
-
Use the decrement operator (--) to decrement the value of "num2" by 1 and output the new value to the console.
Step by step
Solved in 3 steps with 1 images