marks

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //Complete the following function. int marks_summation(int* marks, int number_of_students, char gender) { //Write your code here. int j=0; { if(gender == 'b') { for(int i=0; i<number_of_students; i+=2) j+= marks[i]; } else if (gender=='g') { for(int i=1; i<number_of_students; i+=2) j+= marks[i]; } return j; } { int number_of_students; printf("number_of_students\n"); scanf("%d",&number_of_students); for(int marks=0; marks<number_of_students; marks++) printf("%d",marks); } scanf(" %c",&gender); int sum = marks_summation(marks,j, gender); printf("%d",sum); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines