Blogger templates

Pages

Sunday, 24 June 2012

Write a C Program to Find the Average Marks obtained by a class of 30 Students in a Test

Average Marks

Statemant of C Program: This Program accepts the Marks obtained by 30 Students of a Class in a Test and Compute the Average Marks:  

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
int Avg;
int maks[40];                                                         /* Array Declaration */


clrscr();
sum=0;
 
for( i=0 ; i<=29 ; i++)
{
printf(" Enter Marks/n ");
scanf("%d" , &marks[i] );                                /* Store Data in Array */
}

for( i=0 ; i<=29 ; i++ )
{
Sum = sum + marks[i];                                     /* Read Data from an Array */
Avg = Sum/30;
printf(" Average Marks = %d\n" , Avg);
}

}                                                                         /* End of main() */


Output:
Enter Marks
 2  
 4  
 6  
 8  
 10  
 12  
 14  
 16  
 18  
 20  
 22  
 24  
 26  
 28 
 30  
 32  
 34  
 36  
 38  
 40  
 42  
 44  
 46  
 48  
 50  
 52  
 54  
 56
 58
 60
 Average Marks = 31

                                                                 That's All

0 comments:

Post a Comment