Write a program for the problem: the array of inetegers
indicating the marks of the students is given, U have to
calculate the percentile of the students aaccording to this
rule: the percentile of a student is the %of no of student
having marks less then him. For eg: suppose Student Marks A
12 B 60 C 80 D 71 E 30 F 45 percentile of C = 5/5 *100 =
100 (out of 5 students 5 are having marks less then him)
percentile of B = 3/5*100 = 60% (out of 5, 3 have markses
less then him) percentile of A = 0/5*100 = 0%.



Write a program for the problem: the array of inetegers indicating the marks of the students is gi..

Answer / Varunesh Pandey

Java code for calculating the percentile of students based on their marks would look like this:nn```javanpublic class StudentMarks {n public static void main(String[] args) {n int[] marks = {12, 60, 80, 71, 30, 45};n for (int i = 0; i < marks.length; i++) {n int count = 0;n for (int j = 0; j < marks.length; j++) {n if (marks[i] > marks[j]) {n count++;n }n }n double percentile = ((double)count / (marks.length - 1)) * 100;n System.out.println("Percentile of student with mark " + marks[i] + ": " + percentile + "%");n }n }n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

Is jprofiler open source?

1 Answers  


I am new to jsf rich faces. I am using rich faces datatable rich:datatable. On entering the value, values get filtered in table. Now how can i get the value i selected in backing bean?

1 Answers   Hexaware, IBM,


What is mime in java?

1 Answers  


What is setstring method in java?

1 Answers  


What is a flatmap?

1 Answers  


How do I open java console?

1 Answers  


How do I install jdk?

1 Answers  


What is use of jpa?

1 Answers  


What are orm tools in java?

1 Answers  


What is hql in java?

1 Answers  


What is the use of flatmap?

1 Answers  


Why are lambda functions called lambda?

1 Answers  


Categories