返回列表 發帖
  1. import java.lang.*;
  2. import java.io.Console;
  3. public class ch18
  4. {
  5.     public static void main(String srgs[])
  6.     {
  7.         Console console=System.console();
  8.         int x, y;
  9.         System.out.print("請輸入初始值: ");
  10.         x=Integer.parseInt(console.readLine());
  11.         System.out.print("請輸入終止值: ");
  12.         y=Integer.parseInt(console.readLine());
  13.         for(int i=x; i<=y; i++)
  14.         {
  15.              System.out.println(i);
  16.         }
  17.     }
  18. }
複製代碼

TOP

返回列表