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
juin [17]
3 years ago
6

Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the secon

d with the next to the last, and so on, all the way to the middle of the array. Given an array a and two other int variables, k and temp, write a loop that reverses the elements of the array. Do not use any other variables besides a, k, and temp.
Computers and Technology
1 answer:
Ksivusya [100]3 years ago
4 0

Answer:

// Assume that all variables a, n, temp have been declared.

 // Where a is the array, n is the array length, temp is a temporary

 // storage location.

 // Cycle through the array a.

 // By the time the loop gets halfway,

 // The array would have been reversed.

 // The loop needs not get to the end of the array.

 // Hence, the loop ends halfway into the array i.e n/2.

 for (int k = 0; k < n / 2; k++) {

   

  // Swap first and last, second and next-to-the-last and so on

  temp = a[k];

  a[k] = a[n - k - 1];

  a[n - k - 1] = temp;

 }

Explanation:

Carefully go through the comments in the code.

Hope this helps!

You might be interested in
Which example illustrates the idea of "collecting data"?
ivolga24 [154]

Answer:

A. mining all product reviews from an online store for further processing.

Explanation:

5 0
3 years ago
Read 2 more answers
Online platforms that allow users to represent themselves via a profile on a web site and provide and receive links to other net
Ksju [112]

Main Answer:<u> A Social networking service is an online platform that allow users to represent themselves via a profile and web site and provide and receive links to other network members </u>

Sub heding:

What is social networking service?

Explanation:

1.A social networking services is an online platform that allow users to represent themselves via a profile and web site and provide and receive links to other networks members

2.social networking services vary in format and the numbers of features

Reference link:

https//brainly.com

Hashtag:

#SPJ4

4 0
2 years ago
A(n) ____ is a collection of one or more program statements combined to perform some action
finlep [7]

The answer is Method

A method is a code block of statements that perform a task. By calling a method, a program causes statements to be executed. In C# programming, every instruction that is executed is performed in the context of a method. Technically, it is how behaviors are implemented in C# and are enclosed in parentheses separated by commas






3 0
3 years ago
In a flashdisk wich icon can you use to open files in computer​
Dvinal [7]

Answer:

In a flashdisk,

If you are windows: click "my computer", and under the "cpmputer" section, you will find your flashdisk's name, and click it, in there you can find and also open your files.

If you are Mac: click "Finder", click "Desktop" and find your flashdisk's name, and click it, in there you can find and also open your files.

6 0
3 years ago
A hard drive cannot be partitioned until the device _________ is set.
Elza [17]
Partition(ed) is the answer
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which is the last step in conducting a url research
    11·1 answer
  • Helppppppppppppppppppp
    11·1 answer
  • when you cross or enter traffic from a full stop, how much space should you allow on city streets? on the highway?
    11·1 answer
  • Fedora operating system
    9·1 answer
  • The function below takes two parameters: a string parameter: CSV_string and an integer index. This string parameter will hold a
    14·1 answer
  • The duties of a database administrator include determining which people have access to what kinds of data in the database; these
    13·2 answers
  • 1. What type of malware is triggered by a specific condition, such as a specific date or a particular user account being disable
    6·1 answer
  • You began a small mobile app company. To help market your apps, you create a social media site. The site allows users to join co
    15·1 answer
  • Which view would you need to use to make changes to the design theme for the entire presentation?
    10·2 answers
  • If a work is in the public domain… Group of answer choices its copyright has expired. it may not be used for commercial purposes
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!