Question #263867

Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.



Following are requirements to solve the problem



Teacher should have capture the marks scored by the student.



Teacher should compute the average marks scored by the students.



Teacher should display the average marks scored by the students.



Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.




Expert's answer

#include<stdio.h>
int main(){
	int marks[10][20];
	int i;
	int j;
	int average[10];
	int sum = 0;
	for(i=0; i<10; i++){
		printf("\nEnter marks for student %d", (i+1));
		for(j=0; j<20; j++){
			printf("\nEnter marks:  %d\n", (j+1));
			scanf("%d", &marks[i][j]);
			sum += marks[i][j];
		}
		average[i] = sum /20;
	}
	int k;
	for(k=0; k<10; k++){
		printf("Student %d: Average is %d\n", (k+1), average[k]);
	}
}

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!

LATEST TUTORIALS
APPROVED BY CLIENTS