| 1. |
write a program in Java to accept two integer values and use those values for a printing addition and multiplication |
|
Answer» ong>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 |
|