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
What does it mean when it says this person is unavailable on messenger.
arsen [322]

Answer:

The user has a deactivated account 

Explanation:

or the user does not have the account anymore good luck and I hope you do well <3

4 0
2 years ago
Which statement are true regarding mainframe computers
Dominik [7]

what are the answer choices?

5 0
4 years ago
you just bought a new hard drive for your computer to be used as a secondary hard drive to store all your files after installing
almond37 [142]
The harddrive needs to be partitioned, much like partitioning a room, this is were you allocate space to be used, and used by who. Secondly, a file system needs to installed, to do this you "format" the drive with one of the available File systems that windows can read. Typically on windows this is NTFS or fat32 for older system or devices such as USB sticks.  
6 0
4 years ago
Select the correct answer. Which sign or symbol will you use to lock cells for absolute cell reference?
worty [1.4K]

Answer:

A. ampersand

Explanation:

7 0
3 years ago
Read 2 more answers
A method of using a square grid of imaginary lines to describe part features is known as _____.
Fiesta28 [93]

Answer:

The answer is "Prime Meridian".

Explanation:

The process, that describes an imaginary line in part these features is known as Prime Meridian. It is also known as 0° Longitude in which Longitude is a statistical vector that determines the location to East to West and points on the surface of the Earth or of a paradisaical body surface, and 0° Longitude is the line that describes the Equator and divides the world into two equal quadrants.

4 0
3 years ago
Other questions:
  • Explain a business scenario where management information systems plays a part.
    11·1 answer
  • What is data called that is input into a cryptographic algorithm for the purpose of producing encrypted data?
    14·1 answer
  • When approved for a loan, an individual essentially applied for aid in the area of...
    15·1 answer
  • Which statement describes borders and shading?
    11·2 answers
  • What is the correct method to use Dreamweaver to find broken links and orphaned files?
    15·1 answer
  • Which of the following occurs when the amount of money earned is greater than the
    5·1 answer
  • A student builds a model of an ATP molecule out of some scraps she finds at home. She uses a block of wood for the bulk of the m
    5·1 answer
  • Expliquer les règles à respecter quand on fait une recherche sur internet.
    7·1 answer
  • Consider the algorithm for determining whether a sequence of parentheses is balanced (has correct nesting). The pseudo code for
    10·1 answer
  • What is a security strategy comprised of products and services that offer remote support for mobile devices, such as smart phone
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!