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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started