Students Marks Sum

  • + 0 comments
    int marks_summation(int* marks, int number_of_students, char gender) {
       int sum=0;
       char g,b;
       for(int i=0;i<number_of_students;i++){
           if(i%2!=0 && gender=='g'){
               sum+=marks[i];
           }
           else if(i%2==0 && gender=='b'){
               sum+=marks[i];
           }
       }
       return sum;
    }