Write a Java program that reads a single integer from the input and increases it by 1, and then decreases it by 2, and finally increases it by 3. The final computed integer should be printed as the output.
Increment and decrement
Increase, decrease and increase an integer
Report a typo
Sample Input 1:
25Sample Output 1:
27Sample Input 2:
50Sample Output 2:
52Write a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inputScanner = new Scanner(System.in);
// read the integer from the input
int inputInteger = inputScanner.nextInt();
// your code here - increase the integer by 1, then decrease it by 2, and finally increase it by 3
// print the final computed integer
System.out.println(inputInteger);
}
}
___
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.