003-005-001

Increment: Counter Increase/Decrease

Easy

Problem Description

Increment: Counter Increase/Decrease

In this problem, you will create a program that uses increment (++) and decrement (--) operators to increase and decrease a visitor counter by a specified number of times, and displays the result to standard output.

Learning Objective: Increase/decrease values by 1 with increment/decrement operators

Operate visitor counter. Use ++ to increase by 1, -- to decrease by 1.

Input

Line 1: Initial value (integer)
Line 2: Operation count (integer)

Output

Initial: [value]
After [count] increases: [value+count]
After [count] decreases: [value]

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
10
3
Expected Output:
Initial: 10
After 3 increases: 13
After 3 decreases: 10
Normal case
Input:
50
5
Expected Output:
Initial: 50
After 5 increases: 55
After 5 decreases: 50

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 10 free executions remaining