请假一下各位了55555

img

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入受检测产品数量:");
        int n = scanner.nextInt();
        int[] array = new int[n];
        int info;
        int count=0;
        System.out.println("输入产品质量信息,用换行隔开:");
        for (int i=0;i<array.length;i++){
            info= scanner.nextInt();
            if(info==1){
                count++;
            }
        }
         double rate=(double)count / (double)n;
        //保留两位小数的方法
        java.text.DecimalFormat df = new java.text.DecimalFormat("#.00");
        System.out.println("合格率:"+df.format(rate*100)+"%");
    }
}

请假 发给老师或者领导啊