We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C
- Functions
- Students Marks Sum
- Discussions
Students Marks Sum
Students Marks Sum
Sort by
recency
|
531 Discussions
|
Please Login in order to post a comment
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.
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; }
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; } }
Here is Students Marks sum solution in C - https://programmingoneonone.com/hackerrank-students-marks-sum-solution-in-c.html
help me without any spoilers !!1 i am getting compiler issue #include
include
include
//Complete the following function. int marks_summation(int* marks, int number_of_students, char gender){ int sum = 0, start; if (gender != 'b' && gender != 'g') { return 0; } start = (gender == 'b') ? 0 : 1; for (int i = start; i < number_of_students; i += 2) { sum += marks[i]; } return sum; }
int main() { int number_of_students,sum; char gender;
}