Question: ANSWER IN C LANGUAGE: Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles.

ANSWER IN C LANGUAGE:

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Ex: If the input is: -10 20 30 40 the output is:

Min miles: -10 Max miles: 40

#include

int main(void) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i; int j; int maxMiles = 0; // Assign with first element in milesTracker before loop int minMiles = 0; // Assign with first element in milesTracker before loop

for (i = 0; i < NUM_ROWS; i++){ for (j = 0; j < NUM_COLS; j++){ scanf("%d", &(milesTracker[i][j])); } }

/* Your solution goes here */

printf("Min miles: %d ", minMiles); printf("Max miles: %d ", maxMiles);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!