Students Marks Sum

Sort by

recency

|

532 Discussions

|

  • + 0 comments
    int marks_summation(int* marks, int number_of_students, char gender) {
      int boys_marks = 0, girls_marks = 0;
      if (gender == 'b') {
        for (int i = 0; i < number_of_students; i+=2) {
            boys_marks += marks[i];
        }
      }else{
        for (int i = 1; i < number_of_students; i+=2) {
            girls_marks += marks[i];
        }
      }
      
      return (gender == 'b')? boys_marks: girls_marks;
    }
    
  • + 0 comments

    This feels like how coding handles details precisely, similar to how Professional Tattooing on Dark Skin requires the right technique and attention to nuance for the best outcome.

  • + 0 comments

    int marks_summation(int* marks, int number_of_students, char gender) { int sum=0; //Write your code here. if(gender == 'b') { for(int i =0 ; i } return 0; }

  • + 0 comments

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

  • + 0 comments

    Here is Students Marks sum solution in C - https://programmingoneonone.com/hackerrank-students-marks-sum-solution-in-c.html