是則拋出Exception異常?
剛寫的希望能幫到你
import Java.util.Scanner;
public class chenkun {
public static void main(String[] args) {
Scanner shuru = new Scanner(System.in);
System.out.println("請輸入一個整數");
int a = shuru.nextInt();
if(a>0){
System.out.print(a + "開平方的值是:" + a/2 );
}else{
System.out.print("Exception異常");
}
}
}