Answer to Question #268058 in C for Aakash

Question #268058

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-11-18T15:18:44-0500
#include<iostream>
using namespace std;


int main(){
	int student[] = {4 , 9 , 5 , 3 , 2 , 10};
        cout<<"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++;
                }
            }
            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