I need to make a C program to read the number of students(1<=students<=25) in a class and for every student to read his exam score ex 10/20 15/20 etc(1<=score<=20) and print the max and the max score of students and the average score of class.
I made the program but it performs the for loop only once for some reason.
Can you please help me understand why?
here is the code :
#include <stdio.h>
int main(void) {
    int m,i,b,sum,min,max,mo;
    sum=0;
    while (m<1 || m>25) {
            printf("give number of students ");
            scanf("%d",&m);
    }
    for (i=1; i<(m+1); i++) {
            while (b<1 || b>20) {
            printf("give score of  %d student",i);
            scanf("%d",&b);
            }
            if(i==1) {
                    min=b;
                    max=b;
            }
            else {
                    if(b<min) min=b;
                    if(b>max) max=b;
            }
            sum=sum+b;
    }
    mo=sum/m;
    printf("max is  %d and min is  %d and avg is  %d",max,min,mo);
}
 
     
     
     
     
     
    