Given an integer input, write a Java program that computes the following: divide the number by 2 and display the remainder, then multiply the result by 3 and display the result. The input will be a single integer 'n' (0 ≤ n ≤ 100). Print two lines where the first line shows the remainder of the number divided by 2 and the second line shows the result of the remainder multiplied by 3.
Integer types and operations
Computing the remainder and its triple
Report a typo
Sample Input 1:
10Sample Output 1:
0
0Sample Input 2:
7Sample Output 2:
1
3Write a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int input = scanner.nextInt();
// The first operation goes here
// The second operation goes here
scanner.close();
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.