Q:

WRITE A C PROGRAM TO FIND AVERAGE OF MARKS OBTAINED BY A CLASS OF 30 STUDENTS IN A TEST

0

Write a c program to find average of marks obtained by a class of 30 students in a test

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

int average, total_marks = 0 ; 
		int i ; 
		int marks[30] ; 		/* array declaration */ 
		for ( i = 0 ; i <= 29 ; i++ ) 
			{ 
			printf ( "Enter mark %d:  ",(i+1) ) ; 
			scanf ( "%d", &marks[i] ) ; 		/* store data in array */ 
			} 
		for ( i = 0 ; i <= 29 ; i++ ) 
		total_marks = total_marks + marks[i] ; 		/* read data from an array*/ 
		average = total_marks / 30 ;
		printf ( "\nAverage marks = %d", average ) ; 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now