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
Oxana [17]
3 years ago
14

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
#include

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

for (i = 0; i < NUM_VALS; ++i) {
scanf("%d", &(courseGrades[i]));
}

/* Your solution goes here */

return 0;
}
Computers and Technology
1 answer:
ohaa [14]3 years ago
6 0

Answer:

The solution code is written in C

  1. #include <stdio.h>
  2. int main()
  3. {
  4.    const int NUM_VALS = 4;
  5.    int courseGrades[NUM_VALS];
  6.    int i;
  7.    
  8.    for (i = 0; i < NUM_VALS; ++i) {
  9.        scanf("%d", &(courseGrades[i]));
  10.    }
  11.    
  12.    /* Your solution goes here */
  13.    for(i = 0; i < NUM_VALS; ++i){
  14.        printf("%d ", courseGrades[i]);
  15.    }
  16.    printf("\n");
  17.    
  18.    for(i = NUM_VALS - 1; i >=0; --i){
  19.        printf("%d ", courseGrades[i]);
  20.    }  
  21.    printf("\n");
  22.    
  23.    return 0;
  24. }

Explanation:

The solution is highlighted in the bold font.

To print the elements forward, create a for loop to start the iteration with i = 0 (Line 14). This will enable the program to get the first element and print if out followed with a space (Line 15). The program will take the second element in the next iteration.

To print the elements backward, create a for loop to start the iteration with i = NUM_VALS - 1. The NUM_VALS - 1 will give the last index of the array and therefore the loop will start printing the last element, followed the second last and so on (Line 19 - 21).

You might be interested in
W-11/6=4<br><img src="https://tex.z-dn.net/?f=%20%20%5Cfrac%7Bx%20-%2011%20%7D%7B%206%7D%20%20%3D%204" id="TexFormula1" title="
kozerog [31]

step 1, multiply by 6:

x-11 = 4*6 = 24

step 2, add 11:

x = 35

7 0
3 years ago
Angelina wants her text to look less crowded on the page, so she decides to decrease the length of the space the text occupies.
ratelena [41]

Answer:

She can go to the Layout tab and then to the Page setup command group to increase the margins of the page.

Explanation:

Because margin decides from the text should start ie. it decides how much space should be left on the top of the page, bottom, left and right. If you increase the margin automatically the amount of space in all the four sides gets increased and hence the contents gets automatically adjusted and the text will look better readable than before.

The crowd that it has created before automatically gets adjusted and will give a better look.

8 0
3 years ago
Read 2 more answers
4.15 LAB: Mad Lib - loops Mad Libs are activities that have a person provide various words, which are then used to complete a sh
Sergio039 [100]

Answer:

Following are the program in the Python Programming Language.

#set the infinite while loop

while(True):

 #get string input from the user

 name=input()

 #get integer input from the user

 num=int(input())

 #set the if statement to break the loop

 if(num==0):

   break

 #otherwise, print the following output

 else:

   print("Eating {} {} a day keeps the doctor away.".format(num, name))

<u>Output</u>:

oranges

5

Eating 5 oranges a day keeps the doctor away.

apple

0

Explanation:

<u>Following are the description of the program</u>:

  • Set the loop that iterates at infinite times and inside the loop.
  • Declare two variables which are 'name' that get string type input from the user and 'num' that get integer type input from the user.
  • Set the if conditional statement for break the infinite while loop.
  • Otherwise, it prints the following output.
7 0
3 years ago
How can i see what websites are visited on my wifi
grigory [225]

Answer:

If you want to view sites visited on a wireless network, you can check the logs stored by the wireless router to see what information is available. You may need to set your logging settings to capture the data you want.

Explanation:

5 0
2 years ago
Which model involves the creation of data and process models during the development of an application?
guapka [62]
It seem like there are information missing on the question posted. Let me answer this question with all I know. So here is what I believe the answer is, <span>the creation model involves the creation of data and process models during the development of an application.</span>

Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.
7 0
3 years ago
Read 2 more answers
Other questions:
  • How to reply to text from unknown number?
    11·1 answer
  • A word that has a specific, predefined meaning in a programming language is called
    8·1 answer
  • What are two most common types of microcomputers? a. IBM-style PCs and Macs c. Clients and Servers b. Mainframes and Minicompute
    14·1 answer
  • Mobile devices need to work within limited screen space ? true or false
    9·2 answers
  • (5 points) Create a user-defined data structure (i.e., struct) called Point that represents a two-dimensional Cartesian coordina
    5·1 answer
  • When installing EMT conduit that will be exposed to wet conditions, _______ fittings should be used.
    5·2 answers
  • Tennis players are not allowed to swear when they are playing in Wimbledon
    6·2 answers
  • Learning Management Systems (LMS) allow students to interact with each other, but NOT their teachers.
    10·2 answers
  • G i r l s o n l y j o i n <br> id= ons jcuv jke
    13·2 answers
  • WHO WANT P O I N T S.................................................
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!