Integer operations

Report a typo

Here is the code that takes two numerical values from user input and performs various operations with them. However, expressions are missing, but the comments provide a description of what each line should print. Fill in the blanks with the appropriate expressions to achieve the desired outputs.

Fill in the gaps with the relevant elements
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();

    System.out.println(); // Sum of a and b
    System.out.println(); // Difference of a and b
    System.out.println(); // Product of a and b
    System.out.println(); // Quotient of a divided by b
    System.out.println(); // Remainder of a divided by b
    System.out.println(); // Negation of a
    System.out.println(); // Negation of b
  }
}
___

Create a free account to access the full topic