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
#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);
}
Comments
Leave a comment