Menu

[solved]-Assign Nummatches Number Elements Uservalues Equal Matchvalue Uservalues Numvals Elements Q38995026

Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If u

Write in C language.

Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is 2,1,2,2} and matchValue is 2, then numMatches should be 3. Your code will be tested with the following values: userValues: (2,1,2,2), matchValue: 2 (as in the example program above) userValues: {0, 0, 0, 0), matchValue: 0 userValues: <20, 50, 70, 100), matchValue: 10 (Notes) #include <stdio.h> 1 test passed int main(void) { const int NUM_VALS = 4; int userValues[NUM_VALS]; int i; int matchValue; int numMatches = -99; // Assign numMatches with before your for loop All tests passed scanf(“%d”, &matchvalue); for (i = 0; i < NUM_VALS; ++i) { scanf(“%d”, &(userValues[i])); /* Your solution goes here */ printf(“matchValue: %d, numMatches: %dn”, matchValue, numMatches); return 0; 21 } Run Show transcribed image text Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is 2,1,2,2} and matchValue is 2, then numMatches should be 3. Your code will be tested with the following values: userValues: (2,1,2,2), matchValue: 2 (as in the example program above) userValues: {0, 0, 0, 0), matchValue: 0 userValues:

Expert Answer


Answer to Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex:… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *