This question requires to read in 2 integers A and B, and then output the maximum value of the two numbers.
Input format:
The input gives 2 integers A and B whose absolute value does not exceed 1000 in one line.
Output format:
For each set of inputs, output the maximum value in one row.
Input sample:
A set of inputs is given here. For example:
18 -299
Sample output:
The corresponding output is given here. For example:
18
AC code:
import java.util.Scanner;
public class zuidazhi {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int max=0;
if(n>m){
max=n;
}
else{
max=m;
}
System.out.println(max);
// sc.close();//这行代码带不带,在PTA上都能通过
}
}