Increment, decrement, then double n

Report a typo

Given an integer n, print the value of n after applying the following operations: increment n by 1, then decrement n by 2, then double the resulting value of n.

Sample Input 1:

5

Sample Output 1:

8

Sample Input 2:

10

Sample Output 2:

18
Write a program in Java 17
import java.io.*;
import java.util.*;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Read the integer input
int n = Integer.parseInt(reader.readLine());

// TODO: Increment n by 1

// TODO: Decrement n by 2

// TODO: Double the resulting value of n

// Print the final value of n
System.out.println(n);
}
}
___

Create a free account to access the full topic