返回列表 發帖
  1. import java.util.Scanner;
  2. public class Dc
  3. {
  4.   public static void main(String args[])
  5.   {
  6.     try{
  7.     Scanner a=new Scanner(System.in);
  8.     int x,y;
  9.     System.out.println("請輸入分子x");
  10.     x= a.nextInt();
  11.     System.out.println("請輸入分母y");
  12.     y= a.nextInt();
  13.     System.out.print("x/y="+(x/y));
  14.     }
  15.     catch(Exception exc)
  16.     {
  17.       System.out.println("有誤");
  18.       System.out.println("例外:"+exc.toString());
  19.     }

  20.   }
  21. }
複製代碼

TOP

返回列表