-->
当前位置:首页 > 题库

PROGRAMMING:Program error correction 1

Luz5年前 (2021-05-10)题库449
Program correction. The goal of the following code is to input an integer x from the keyboard, then do different calculations according to the value of X, and output the results( Procedure error, please correct and submit)

import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int x, j = 1;
x = in.nextInt();
switch (x) {
case 1:
j++;
case 2:
j++;
case 3:
j = x*j++;
case 4:
j= x + j++;
case 5:
j = x - j++;
default:
j = x;
}
System.out.println(j);
}
}

###Input format:
Enter the integer X.
###Output format:
Output value.
###Input example:
```in
five
```
###Output example:
```out
four
```







answer:If there is no answer, please comment