subject

1) Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 and userVals = {2, 2, 1, 2}, then numMatches = 3.

#include

int main(void) {
const int NUM_VALS = 4;
int userValues[NUM_VALS];
int i = 0;
int matchValue = 0;
int numMatches = -99; // Set numMatches to 0 before your for loop

userValues[0] = 2;
userValues[1] = 2;
userValues[2] = 1;
userValues[3] = 2;

matchValue = 2;

/* Your solution goes here */

printf("matchValue: %d, numMatches: %d\n", matchValue, numMatches);

return 0;
}

2)Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using scanf. Ex: If NUM_GUESSES is 3 and user enters 9 5 2, then userGuesses is {9, 5, 2}.

#include

int main(void) {
const int NUM_GUESSES = 3;
int userGuesses[NUM_GUESSES];
int i = 0;

/* Your solution goes here */

return 0;
}

3)Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.

#include

int main(void) {
const int NUM_VALS = 4;
int testGrades[NUM_VALS];
int i = 0;
int sumExtra = -9999; // Initialize to 0 before your for loop

testGrades[0] = 101;
testGrades[1] = 83;
testGrades[2] = 107;
testGrades[3] = 90;

/* Your solution goes here */

printf("sumExtra: %d\n", sumExtra);
return 0;
}

4)Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92, 94, 95}, print:

90, 92, 94, 95
Note that the last element is not followed by a comma, space, or newline.

#include

int main(void) {
const int NUM_VALS = 4;
int hourlyTemp[NUM_VALS];
int i = 0;

hourlyTemp[0] = 90;
hourlyTemp[1] = 92;
hourlyTemp[2] = 94;
hourlyTemp[3] = 95;

/* Your solution goes here */

printf("\n");

return 0;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 24.06.2019 19:30
Dtp allows you to manipulate text boxes in the following ways. more than 1 answer. a.move them b.rotate them c.resize them d.all of the above e.none of the above
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
Rom is designed for computer instructions temporary storage of data processing data
Answers: 1
You know the right answer?
1) Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal mat...
Questions
question
Mathematics, 17.11.2020 22:20
question
English, 17.11.2020 22:20
question
Mathematics, 17.11.2020 22:20
question
Mathematics, 17.11.2020 22:20
Questions on the website: 13722363