![]() |
VOOZH | about |
Given the rank of a student and the total number of students appearing in an examination, the task is to find the percentile of the student.
The percentile of a student is the % of the number of students having marks less than him/her.
Examples:
Input: Rank: 805, Total Number of Students Appeared: 97481
Output: 99.17
Explanation:
((97481 - 805) / 97481) * 100 = 99.17
Input: Rank: 65, Total Number of Students Appeared: 100
Output: 35
Explanation:
((100 - 65) / 100) * 100 = 35
Approach
The formula to calculate the percentile when the rank of the student and the total number of students appeared is given is:
((Total Students - Rank) / Total Students) * 100
Below is the implementation of the above formula:
C++
99.1742
Performance Analysis: