score below 60


Submit solution

Points: 20
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

題目說明

<1113檢定考題>
撰寫一個程式,請使用者從鍵盤逐一輸入成績資料,直到輸入負數或超過100分為止,由螢幕列出低於60的分數與人數。

輸入

從鍵盤逐一輸入成績資料,直到輸入負數或超過100分為止

輸出

由螢幕列出低於60的分數與人數

samplt input & output

樣本1 樣本2 樣本3
輸入 99
77
38
46
60
75
18
-1
81
62
67
43
56
6
105
100
53
15
66
90
28
65
59
0
-3
輸出 未達60分以上3人
包含:
38
46
18
未達60分以上4人
包含:
0
43
56
6
未達60分以上5人
包含:
53
15
28
59
0

Comments


  • 0
    scu10156189  commented on June 14, 2024, 11:56 a.m.

    樣本2測資是不是有問題?


  • 0
    scu10156165  commented on Jan. 26, 2024, 3:01 p.m.

    import java.util.Scanner; public class p {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input = new Scanner(System.in);
        int n;
        int count=0;
        int x [] = new int[1000];
        while(true) {
            n=input.nextInt();
            if(n<0||n>100) {
                break;
            }
            else {
                if(n<60) {
                x[count] = n;
                count++;
                }
            }
        }
        System.out.print("未達60分以上"+count+"人");
        System.out.println();
        System.out.println("包含:");
        for(int i=0;i<count;i++) {
            System.out.println(x[i]);
        }
    }

    }


  • 0
    scu10156153  commented on Jan. 14, 2024, 11:10 p.m.

    求解