阿盧今天為了趕作業連熱舞都沒去~ 練完管樂回來的時候 就開始幫他寫 除了讓使用者輸入的部份,剩餘的都是我寫的 底下這部分是阿盧所寫 ---------------------------------------------------------------------- import java.util.Scanner; public class prog1 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int[] g = new int[50]; int index; System.out.println("請輸入一串數列,最多50個"); System.out.println("當輸入0時結束"); for (index = 0; index < 50; index++) { g[index] = keyboard.nextInt(); if (g[index] == 0) break; } ------------------------------------------------------------------------------- 這題是要讓使用者輸入數字 50個以下,可以重複 印出來的結果是排序及個數 EX:1,2,3,5,1,9,10,-12,2,5,5,3 Print: N Count 10 1 9 1 5 3 3 2 2 2 1 2 -12 1 以下為程式碼 ______________________________________________________________________________________________________ import java.util.Scanner; public class prog1 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int[] g = new int[50]; int index; System.out.println("請輸入一串數列,最多50個"); System.out.println("當輸入0時結束"); for (index = 0; index < 50; index++) { g[index] = keyboard.nextInt(); if (g[index] == 0) break; } int temp; for(int i=0;i
文章標籤
全站熱搜
創作者介紹
創作者 nnosnhoj 的頭像
nnosnhoj

弱弱工程師的筆記本

nnosnhoj 發表在 痞客邦 留言(0) 人氣(93)