1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
enyata [817]
3 years ago
9

Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards

, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10},
print:
7 9 11 10
10 11 9 7

Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1.

#include

int main(void) {
const int NUM_VALS = 4;
int courseGrades[NUM_VALS];
int i = 0;
courseGrades[0] = 7;
courseGrades[1] = 9;
courseGrades[2] = 11;
courseGrades[3] = 10;

/* Your solution goes here */
return 0;
}
Computers and Technology
1 answer:
konstantin123 [22]3 years ago
4 0

Answer:

for(i = 0 ; i < NUM_VALS; ++i)

{

   cout << courseGrades[i] << " ";

}

cout << endl;

for(i = NUM_VALS-1 ; i >=0 ; --i)

{

   cout << courseGrades[i] << " ";

}

cout << endl;

Explanation:

The first loop initializes i with 0, because we have to print the elements in order in which the appear in the array. We print each element, adding a space (" ") character at its end. After the loop ends, we add a new line using endl.

The second loop will print the values in a reverse order, so we initialize it from NUM_VALS-1, (since NUM_VALS = 4, and array indices are 0,1,2,3). We execute the loop till i >= 0, and we print the space character and new line in a similar way we executed in loop1.

You might be interested in
A ___________ organizes related commands together, under a tab.
notsponge [240]
A menu bar organizes related commands together, under a tab.
So the answer is <span>b. menu bar</span>
8 0
3 years ago
Real estate management software
andre [41]

Answer:

nTireFM

Explanation:

is a comprehensive system for real estate vendors with unique and reliable needs. Real Estate Management Software simplifies your life as a real estate investor monitors the financial performance of each rental property

5 0
11 months ago
Which is a common problem caused by the widespread use of computers?
Andru [333]
Hacking would be a widespread problem.
8 0
3 years ago
Calculate the average high and low in python code for beginners pls
Nikolay [14]

Answer:

There are two ways to find the average of a list of numbers in Python. You can divide the sum() by the len() of a list of numbers to find the average. Or, you can find the average of a list using the Python mean() function

Explanation:

3 0
3 years ago
While working independently, you need to weigh your options on a topic. You research and analyze the topic so you can ensure you
Andrews [41]
I think this process would be Decision-Making, because the scenario is that you have to decide on what topic you are going to pick, based on research and what you think would be the best resolution. I don't think that Conflict resolution would be correct because there is no conflict and neither Negotiation nor Verbal Communication have anything to do with this, so i believe it's safe to assume the correct answer would be Decision Making.
8 0
3 years ago
Read 2 more answers
Other questions:
  • When purchasing a(n) ________ computer, having cellular as well as wifi can be important?
    9·1 answer
  • How have search engines like Google, Bing, and Yahoo! revolutionized the ability to do research? They are more difficult to acce
    15·2 answers
  • Which command on the Insert tab of the PowerPoint Online application is used to add a Venn diagram or process chart to a present
    12·2 answers
  • Which data type is most suitable for a password field
    12·1 answer
  • For Windows 9x and Windows NT operating systems, which authentication protocol should be used that protects the authentication p
    11·1 answer
  • The benefit from dividing code into methods known as ________ is gained as follows: After you write code to perform a task once,
    14·1 answer
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • In C!!
    11·1 answer
  • Davingould1115...................answer 2​
    11·2 answers
  • How does accenture generate value for clients through agile and devops?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!