You are viewing a single comment's thread. Return to all comments →
//Complete the following function.
int marks_summation(int* marks, int number_of_students, char gender) {
//Write your code here. int sum = 0; for (int i =0;number_of_students -1 >= i; i ++) { if(i % 2 == 0 && gender == 'b'){ sum=sum+marks[i]; } else if(i%2!=0 && gender=='g') sum=sum+marks[i]; } return sum; }
Seems like cookies are disabled on this browser, please enable them to open this website
Students Marks Sum
You are viewing a single comment's thread. Return to all comments →
//Complete the following function.
int marks_summation(int* marks, int number_of_students, char gender) {
//Write your code here. int sum = 0; for (int i =0;number_of_students -1 >= i; i ++) { if(i % 2 == 0 && gender == 'b'){ sum=sum+marks[i]; } else if(i%2!=0 && gender=='g') sum=sum+marks[i]; } return sum; }