100% Wrong Answer is shown in Java

Anwar Hasan Shuvo asked 1 month ago

100% Wrong Answer is shown for the following code written in Java. However, correct outputs are shown for the codes.

import java.util.Scanner;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args)
        Scanner scanner = new Scanner(;

        ArrayList<Integer> students_marks = new ArrayList<Integer>();

        int test_case = scanner.nextInt();

        for(int i=0; i<test_case; i++)
            int students_no = scanner.nextInt();
            int marks_sum=0;
            int student_count=0;

            for(int j=0; j<students_no; j++)
                int marks = scanner.nextInt();

                marks_sum += marks;

            int average_marks = marks_sum / students_no;

            for(int k=0; k<students_no; k++)
                if(average_marks < students_marks.get(k))

            double student_average = ((double) student_count / (double) students_no) * 100;

            System.out.printf("%.3f", student_average);



This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.