Computers and Technology, 04.08.2020 22:01 crobinson7206
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;
}
Answers: 2
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
Computers and Technology, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
Computers and Technology, 24.06.2019 13:00
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x,y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
1)
Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal mat...
Engineering, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
English, 18.05.2021 23:00
Geography, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
Social Studies, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
Biology, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00
Mathematics, 18.05.2021 23:00