Answer to Question #235896 in Java | JSP | JSF for Guru

Question #235896
The placement season has begun in a college. There are N number of students standing outside an interview room in a line. It is given that a person who goes in first has higher chances of getting selected.
Input1- an integer N, which denotes the number of students present
Input2- An array of size N, denoting the problem solving capacity of the students.

Each student has a number associated with them known as the problem-solving capability (PSC). The higher the capability, the higher the chances of selection. Now, each student wants to know the number of students ahead of him/her who have more problem-solving capability than him/her.

Find this number for each student.
1
Expert's answer
2021-09-11T07:01:28-0400


package placementseason;




public class PlacementSeason {


    public static void main(String[] args) {
        //You can any integer to test the program
        int student[] = {4 , 9 , 5 , 3 , 2 , 10};
        System.out.printf("Output:\n");
        for(int i=0; i<6; i++){
            int count = 0;
            for(int j=0; j<i; j++){
                if(student[j]>= student[i]){
                    count++;
                }
            }
            System.out.printf("%d,  ",count);
        }
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS