In this HackerRank Students Marks Sum problem in C programming problem, we need to complete the function marks_summation that has two integer types of arrays and a second character type of variable as a parameter.
HackerRank Students Marks Sum in c problem solution
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int marks_summation(int* p, int number_of_students, char gender) {
int s = 0, i = 0;
if (gender == 'g') {
i++;
}
for (; i < number_of_students; i = i+2) {
s += p[i];
}
return s;
}
1 Comments
Informative content ! :)
ReplyDeleteAlso check Students Marks Sum – Hacker Rank Solution
https://www.codeworld19.com/students-marks-sum-hacker-rank-solution/