Search Here

C program to calculate average marks of n students



/* C program to calculate Average Marks of n students */

void main()
{
    int i,m,n,total,average;
    
    printf("Enter the no. of the students: ");
    scanf("%d",&n);
    i=1;
    total=0;
    while(i<=n)
    {
        printf("Enter the marks of the no.%d student: ",i);
        scanf("%d",&m);
        i=i+1;
        total=total+m;
    }
    average=total/n;
    printf("\nThe average marks is: %d",average);
}

Output

No comments:

Post a Comment