- import java.io.Console;
- public class Ch05
- {
- public static void main(String args[])
- {
- int x,y;
- Console c=System.console();
- x=Integer.parseInt(c.readLine("輸入x的值:"));
- y=Integer.parseInt(c.readLine("輸入y的值:"));
- System.out.println("x+y="+(x+y));
- System.out.println("x-y="+(x-y));
- System.out.println("x*y="+(x*y));
- System.out.println("x/y="+(x/y));
- System.out.println("x%y="+(x%y));
- }
- }
複製代碼 |