|
|
|
@ -1,28 +0,0 @@
|
|
|
|
|
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
|
|
|
|
|
public class ExcTest {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
// 请在Begin-End间编写代码
|
|
|
|
|
/********** Begin **********/
|
|
|
|
|
// 第一步:接收给定的整数
|
|
|
|
|
Scanner input=new Scanner(System.in);
|
|
|
|
|
int a = input.nextInt();
|
|
|
|
|
int b = input.nextInt();
|
|
|
|
|
int x;
|
|
|
|
|
// 第二步:求给定两个数的商,并捕获除数为0的异常
|
|
|
|
|
try{
|
|
|
|
|
x = a / b;
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e){
|
|
|
|
|
{
|
|
|
|
|
System.out.println("除数不能为0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(b != 0){
|
|
|
|
|
System.out.println(a / b);
|
|
|
|
|
}
|
|
|
|
|
/********** End **********/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|