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
|
504 Discussions
|
Please Login in order to post a comment
These lines have to be written inside the marks_summation():
//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; }
instad of putting code, we could maybe discuss about the question first in simple english ?
int marks_summation(int* marks, int number_of_students, char gender) { int sum=0; if(gender == 'b'){ for(int i=0;i