Students Marks Sum

  • + 0 comments
    int sum=0;
      if(gender=='b'){
          for(int i=0;i<number_of_students;i+=2){
              sum+=marks[i];
          }
        return sum;
      }
      else{
          for(int i=1;i<number_of_students;i+=2){
              sum+=marks[i];    
          }
        return sum;
      }
    }