Header Ads

Average marks obtained by total number of students in a class

How to calculate average marks of total student in a class using one dimensional matrix in C

*************************************Program***********************************

#include<stdio.h>
#include<conio.h>
main()
{
    int n,i;
    int m[200];
    float avg=0;
    printf("Enter the numbers of students : ");
    scanf("%d",&n);
    printf("\n\n");
    for(i=1;i<=n;i++)
    {
        printf("Enter the mark of student%d : ",i);
        scanf("%d",&m[i]);
        avg=m[i]+avg;
    }
    avg=avg/n;
    printf("\n\n");
    printf("Average marks obtained by Total %d students are : %.3f",n,avg);
    getch();

}


*************************************Output************************************

Screen shot for above program

No comments