- package mhjh.mtc;
- import java.util.Scanner;
- public class WWW {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- Scanner scanner= new Scanner(System.in);
- System.out.println("請輸入分子");
- int num1=scanner.nextInt();
- System.out.println("請輸入分母");
- int num2=scanner.nextInt();
- int result=0;
- try{
- result=num1/num2;
- }
- catch(Exception ex)
- {
- System.out.println(ex.toString());
- }
- System.out.println(result);
-
- }
- }
複製代碼 |