This assignment is a grade calculatorusing c not c A portion
This assignment is a grade calculator(using c not c++).
A portion of the code is included in the nested loop document. It will need to be modified of course to include the grade variable and weight array variable. Also, change the marks array indices to 4 students and 5 marks so as to make it easier to input the info.
The weight array should be described as follows: weight[] = {1, 1, 0.8333, 0.75, 0.6667}
The output should look like:
Student #1\'s final mark is 74.62%
Student #2\'s final mark is 68.46%
Student #3\'s ...
Remember, there will be 4 students and the flowchart is your guide to writing the code.
START IS no j 4 yes IS no i 5 yes input marks [ji[ij i 1 j -j 1 IS no 4 END yes grade 0 no /output IS I 5 j, grade yes weight ilxmarkslil i 1 j -j 1Solution
Here is code:
#include <stdio.h>
int main(void) {
int i=0;
int j=0;
int marks[4][5];
double weight[]={1, 1, 0.8333, 0.75, 0.6667};
for(j=0;j<4;j++){
printf(\"\ Input marks of the 5 subjects separetely of student no : %d\",j+1);
for(i=0;i<5;i++){
scanf(\"%d\",&marks[j][i]);
}
}
double grade;
for(j=0;j<4;j++){
grade=0;
for(i=0;i<5;i++){
grade=grade+(weight[i] * marks[j][i]);
}
printf(\"Student #%d\'s final marks is %4.2lf \ \",j + 1,grade);
}
return 0;
}
Note:
press enter after writing mark of each subject while inputting
