返回列表 發帖
  1. import java.util.Arrays;
  2. public class ch49
  3. {
  4.     public static void main(String args[])
  5.     {
  6.       Scanner n=new scanner(System.in);
  7.         int x,y;
  8.       try{
  9.       System.out.print("輸入分子: ");
  10.           x=n.nextInt();
  11.       System.out.print("輸入分母:");
  12.           y=n.nextInt();
  13.            System.out.print(x+"/"+y+"="+(x/y));
  14.       }
  15.        catch(Exception ex)
  16.        {
  17.         System.out.println("程式發生錯誤!");
  18.         System.out.println("例外類別:"+ex.toString());
  19.     }
  20. }
複製代碼

TOP

返回列表