返回列表 發帖

while 迴圈

本帖最後由 tonyh 於 2014-6-7 15:32 編輯

利用 while 迴圈, 直列印出1~10.
  1. public class ch23
  2. {
  3.     public static void main(String args[])
  4.     {
  5.          int i=1;
  6.          while(i<=10)
  7.          {
  8.                System.out.println(i);
  9.                i++;
  10.          }
  11.     }
  12. }
複製代碼

返回列表