- import java.util.Scanner;
- public class Dc
- {
- public static void main(String args[])
- {
- try{
- Scanner a=new Scanner(System.in);
- int x,y;
- System.out.println("請輸入分子x");
- x= a.nextInt();
- System.out.println("請輸入分母y");
- y= a.nextInt();
- System.out.print("x/y="+(x/y));
- }
- catch(Exception exc)
- {
- System.out.println("有誤");
- System.out.println("例外:"+exc.toString());
- }
- }
- }
複製代碼 |