Answer to Question #269200 in C for mona

Question #269200

write a program which takes the input from these arrays and decides the maximum runs that your favourite player has to score so far in order to get the orange cap. [The orange cap is awarded to the person who scores maximum runs in the tournament]. Also, please find out the maximum strike rate achieved by a batsman so far. Note: In total you are given 8 arrays represent the runs scored and the next 4 represent the total number of balls faced.

Sample Run:

Input:


[10, 45, 500, 400, 45, 56, 67, 78, 100, 8, 11]

[100, 450, 510, 410, 415, 56, 68, 87, 101, 9, 9]

[404, 445, 520, 450, 415, 156, 167, 488, 110, 4, 2]

[505, 445, 554, 410, 445, 556, 167, 178, 70, 4, 1]


[20, 100, 500, 345, 45, 65, 86, 69, 100, 7, 10]

[101, 246, 500, 355, 145, 165, 45, 45, 54, 8, 9]

[434, 456, 550, 395, 445, 165, 96, 369, 100, 4, 6]

[520, 340, 500, 405, 345, 565, 186, 169, 67, 3, 2]


Output:

Maximum Runs Scored: 556

Maximum Strike Rate: 286.206897​



1
Expert's answer
2021-11-21T17:39:07-0500
#include<stdio.h>
int main(){
	int arr[4][11] = {{10, 45, 500, 400, 45, 56, 67, 78, 100, 8, 11},{100, 450, 510, 410, 415, 56, 68, 87, 101, 9, 9},
	{404, 445, 520, 450, 415, 156, 167, 488, 110, 4, 2}, {505, 445, 554, 410, 445, 556, 167, 178, 70, 4, 1}};
	int max = arr[0][0];
	int i, j;
	for(i=0; i<4; i++){
		for(j=0; j<11; j++){
			if(arr[i][j]>max){
				max = arr[i][j];
			}
		}
	}
	int score[4][11] ={{20, 100, 500, 345, 45, 65, 86, 69, 100, 7, 10}, {101, 246, 500, 355, 145, 165, 45, 45, 54, 8, 9},
	{434, 456, 550, 395, 445, 165, 96, 369, 100, 4, 6	}, {520, 340, 500, 405, 345, 565, 186, 169, 67, 3, 2}};
	printf("Maximum Runs Scored: %d", max);
	
	int k,x;
	int sum = 0;
	for(k=0; k<4;k++){
		for(x=0; x<11; x++){
			sum += score[k][x];
		}
	}
	printf("\nMaximum Strike Rate: %d", sum/44);
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS