Board logo

標題: [作業] 亂數 (四) [打印本頁]

作者: tonyh    時間: 2014-6-14 15:27     標題: [作業] 亂數 (四)

本帖最後由 tonyh 於 2014-6-21 14:15 編輯

產生15組範圍介於123~128之隨機亂數.
  1. public class ch31
  2. {
  3.     public static void main(String args[])
  4.     {
  5.         for(int i=1; i<=15; i++)
  6.             System.out.println((int)(Math.random()*6+123));
  7.     }
  8. }
複製代碼

作者: 鎧言    時間: 2014-6-14 17:21

  1. import java.lang.Math;
  2. public class ch32
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          for(int i=1; i<=15; i++)
  7.               System.out.println((int)(Math.random()*6+123));
  8.     }
  9. }
複製代碼

作者: 黃崇維    時間: 2014-6-20 23:41

  1. import java.lang.Math;
  2. public class ch32
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          for(int i=1; i<=15; i++)
  7.               System.out.println((int)(Math.random()*6+123));
  8.     }
  9. }
複製代碼

作者: 張瀚仁    時間: 2014-6-21 10:24

本帖最後由 張瀚仁 於 2014-6-21 14:14 編輯
  1. public class ch32
  2. {
  3.     public static void main(String args[])
  4.     {
  5.         for(int i=1;i<=15;i++)
  6.             System.out.println((int)(Math.random()*6+123))
  7.     }

  8. }
複製代碼

作者: 林以諾    時間: 2014-6-21 14:23

  1. public class ch32
  2. {
  3.     public static void main(String args[])
  4.     {
  5.         for(int i=1; i<=15; i++)
  6.             System.out.println((int)(Math.random()*6+123));
  7.     }
  8. }
複製代碼

作者: 劉泳鱔    時間: 2014-6-21 14:23

  1. public class ch31
  2. {
  3.        public static void main(String args[])
  4.        {
  5.               for(int i=1; i<=15; i++)
  6.               System.out.println((int)(Math.random()*6+123());
  7.        }
  8. }
複製代碼

作者: 劉得恩    時間: 2014-6-21 14:41

  1. public class ch31
  2. {
  3. public static void main(String[] args)
  4. {
  5.   for(int i=0;i<=15;i++)
  6.    System.out.println((int)(Math.random()*6+123));




  7. }

  8. }
複製代碼





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