Board logo

標題: 陣列之練習 [打印本頁]

作者: 李泳霖    時間: 2023-2-6 14:22     標題: 陣列之練習

[attach]15123[/attach]
  1. public class Ch03 {
  2.         public static void main(String[] args) {
  3.                   int num=0;//存放大於50的個數
  4.                 int num2=0;//存放小於50的個數
  5.                 int [] a=new int []{20,45,78,34,16,3,99,56};
  6.                 /*
  7.                  * 請使用迴圈找出a陣列大於50的個數幾個
  8.                  * .
  9.                  * .
  10.                  */
  11.                 System.out.println("大於50的個數為:"+num);

  12.                 /*
  13.                  * 請使用迴圈找出a陣列小於於50的個數幾個
  14.                  * .
  15.                  * .
  16.                  */       
  17.                 System.out.print("小於50的個數為:"+num2);
  18.         }


  19. }
複製代碼

作者: 余俊霆    時間: 2023-2-6 14:35

此帖僅作者可見




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