write a program in Java to accept two integer values and use those values for a printing addition and multiplication
Answers
Answered by
1
Answer:
import java.util.Scanner; // Import the Scanner class
class Addmultwonumber {
public static void main(String[] args) {
int x, y, sum,mul;
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Type a number:");
x = myObj.nextInt(); // Read user input
System.out.println("Type another number:");
y = myObj.nextInt(); // Read user input
sum = x + y; // Calculate the sum of x + y
mul = x * y; // Calculate the multiplication
System.out.println("Sum is: " + sum); // Print the sum
System.out.println("Product is: " + mul); //print the multiplication value
}
}
Explanation:
hope this is helpful please mark as brain list and follow me for more solution
Similar questions
Social Sciences,
2 months ago
Political Science,
2 months ago
Math,
2 months ago
Computer Science,
5 months ago