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
loris [4]
3 years ago
11

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 = courseGrades.length - 1. (Notes) Note: These activities may test code with different test values. This activity will perform two tests, both with a 4-element array. See "How to Use zyBooks". Also note: If the submitted code tries to access an invalid array element, such as courseGrades[9] for a 4-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message.
Computers and Technology
1 answer:
Oksanka [162]3 years ago
4 0

Answer:

Following are the loop in c language

t = sizeof(courseGrades)/sizeof(courseGrades[0]);  // determine the size of array

   for(int i=0;i<t;++i) // iterating loop

   {

printf("%d ",courseGrades[i]);  // print the array in forward direction with space  

   }

   for(int i=t-1;i>=0;--i)// iterating loop

   {

printf("%d ",courseGrades[i]); // print the array in backward direction with space

  }

Explanation:

In this firstly we find a size of the courseGrades array in variable "t" after that we created a loop for print  the courseGrades array in forward direction with space.

finally we created a loop  for printing  the courseGrades array in backwards direction.

Following are the program in c language :

#include <stdio.h> // header file

int main() // main function

{

   int courseGrades[]={7, 9, 11, 10}; // array declaration

  int t; // variable t to store the length of the array

  t = sizeof(courseGrades)/sizeof(courseGrades[0]); // determine the size of array

   for(int i=0;i<t;++i)  // iterating loop

   {

printf("%d ",courseGrades[i]); //print the array in forward direction with space  

       

   }

   for(int i=t-1;i>=0;--i) // iterating loop

   {

printf("%d ",courseGrades[i]);//  // print the array in backward direction with space  

       

   }

  return 0;

}

Output:

7 9 11 10 10 11 9 7

You might be interested in
The numbers, text, or cell references used by the function to return a value are called ____.
Alenkasestr [34]
The numbers, text or cell references used by the function to return a value are called ARGUMENTS. In computers and technology, arguments is referred to as a value that is assigned to something that returns when it is stated in a code.
8 0
4 years ago
To place the caption at the top of the image you will need to change the ________
makkiz [27]

wrong!! it was postion!!

4 0
4 years ago
The Math class provides a static method, max, that accepts two int arguments and returns the value of the larger one. Two int va
Dimas [21]

Answer:

int result=max(population1,population2);

printf("%d",result);

Explanation:

in above result variable holds the largest value of two variables population1 and population2.Printf displays that largest value.

int result=max(population1,population2);

in above expression , right hand side we are calling max function and on the left hand side we are saving the return value of the function in result variable

8 0
3 years ago
You would like to see only the last 15 lines of /home/user/log file on your linux machine. Which command line interface (cli) co
BARSIC [14]

In Linux computer systems, "tail -n 15 /home/user/logfile" is a command line interface (cli) command that should be used to view only the last 15 lines of /home/user/log file.

<h3>What is a Linux command?</h3>

A Linux command can be defined as a software program that is designed and developed to run on the command line, in order to enable an administrator (end user) of a Linux network perform both basic and advanced tasks by entering a line of text.

In Linux computer systems or machines, a command line interface (cli) command that should be used by an administrator (end user) to view only the last 15 lines of /home/user/log file is "tail -n 15 /home/user/logfile."

In conclusion, the above command would reveal only the last 15 lines of /home/user/log file on a Linux computer system.

Read more on Linux commands here: brainly.com/question/25480553

#SPJ1

3 0
2 years ago
A<br> is an list of steps to complete a task. *
nlexa [21]

Explanation:

hope it helps

pls mark me brainliest thanks

4 0
3 years ago
Other questions:
  • Mobile providers can be susceptible to poor coverage indoors as a result of: a high degree of latency. network congestion that c
    8·1 answer
  • If you reformat the hard drive on a computer, it erases all personal information from your computer and makes it safe to donate.
    6·1 answer
  • Which sequence of slides would be followed in a linear slideshow? A. slide 4 -&gt; slide 5 -&gt; slide 6 -&gt; slide 7 B. slide
    8·2 answers
  • Which letter is located at position (7,4) on this coordinate grid? A) B) C) D)
    12·1 answer
  • Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user en
    6·1 answer
  • Software built and delivered in pieces is known as
    14·2 answers
  • How can i change my age on my profile here bc i am 13 but i accidenlty put 2005 instead of 2006 no need to rush to answer just w
    9·2 answers
  • Write a constructor for BaseballPlayer. The constructor takes three int parameters: numHits, numRuns, and numRBIs storing the va
    12·1 answer
  • What are the cloud storage components
    6·1 answer
  • Find H.C.F of 4,5,10 by all the three methods.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!