Answer to Question #265873 in C for Addu

Question #265873

There are N coding questions and the score for Ith question must be in the range of 1 to N(inclusive). All the coding questions follow one rule that higher the score higher is difficulty level. Now Tom is trying to assign the score to each question in a sorted difficulty order such that 1st question is of least difficulty level and Nth question is of most difficulty level. And it is also possible that more than one question can have equal score.

1
Expert's answer
2021-11-15T00:22:38-0500
#include<stdio.h>
#include<conio.h>
int main(){ 
int question;
int questions[];
printf(''Enter the number of questions:'');
scanf(''%d'',&question);
printf(''Enter the rating of questions:'');
for(int i=0;i<question;i++){
scanf(''%d'',&questions[i]);
}
int temp;
for(int i=0;i<questions.length;i++){
  for(int j=i+1; j<questions.length;j++){
    if(questions[i]<questions[j]){
        temp=questions[i];
        questions[i]=questions[j];
        questions[j]=temp;
      }
  }

}
printf(''Questions with their shorted order is listed below :'');
for(int i=0;i<questions.length;i++){
  printf(''%d'',questions[i]);
}

return 0;}


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