//Calculate total runs scored by cricket team
#include <stdio.h>
#include<string.h>
#include<math.h>
int run_sum(int);
struct player{
char str[10];
int a;
};
void main(){
int c,d;
printf("ENTER TOTAL NUMBER OF PLAYER IN TEAM =\n\n");
scanf("%d",&c);
struct player arr[c];
for(int i=0;i<c;i++){
scanf("%s",&arr[i].str[0]);
scanf("%d",&arr[i].a);
}
for(int i=0;i<c;i++){
printf("%s",arr[i].str);
printf("\t\t\t%d\n",arr[i].a);
d=run_sum(arr[i].a);
}
printf("\nTOTAL RUN SCORED BY TEAM = %d",d);
}
int run_sum(int x){
int sum=0;
sum=sum+x;
return(sum);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: