Quick actions

cmd+k|ctrl+k

Navigation

Languages

marks

Snippet info

Language

C

Visibility

public

Author

sriram

Created

2022-12-28T00:49:58.00478Z

Updated

2022-12-28T00:49:58.00478Z

#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;
   
}
INFO