Board logo

標題: while 迴圈 [打印本頁]

作者: tonyh    時間: 2012-9-8 16:10     標題: while 迴圈

本帖最後由 tonyh 於 2012-9-8 16:17 編輯

利用 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. }
複製代碼

作者: t2364705    時間: 2012-9-8 16:12

  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. }
複製代碼

作者: 尤泓鈞    時間: 2012-9-8 16:15

  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. }
複製代碼

作者: 劉漢文    時間: 2012-9-8 16:16

  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. }
複製代碼

作者: 蔡昀佑    時間: 2012-9-8 16:17

  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. }
複製代碼

作者: 粘靖瑜    時間: 2012-9-8 16:19

  1. public class ch23
  2. {
  3.     public static void main (String arg[])
  4.     {
  5.           int i=1;
  6.           while(i<=10)
  7.           {
  8.                 System.out.println(i);
  9.                 i++;

  10.           }
  11.     }
  12. }
複製代碼

作者: t3742238    時間: 2012-9-8 16:20

  1. public class ch16
  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. }
複製代碼

作者: 黃博鴻    時間: 2012-10-27 13:58

  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. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2