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
WINSTONCH [101]
3 years ago
11

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, an int variable n containing the number of elements in 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, n, k, and temp.
Computers and Technology
1 answer:
Debora [2.8K]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;

 } // End of for loop

Explanation:

Explanation has been given in the code in form of comments. Kindly go through the comments in the code.

Hope this helps!

You might be interested in
Which of the following inputs help robotic vacuum cleaners maneuver around obstacles?
Alja [10]

Answer:

c lasers and sensors

Explanation:

7 0
3 years ago
Read 2 more answers
A typical, small, dry cell battery has a voltage of A. 6.0 volts. B. 1.0 volts. C. 12.0 volts. D. 1.5 volts.
Bad White [126]
The answer is D 1.5 volts
6 0
3 years ago
Read 2 more answers
You have a notebook computer and wish to connect to an IEEE 802.11n wireless network. The computer does not have a built-in wire
Ira Lisetskai [31]

Answer:

The wireless adapter to use is the Wireless USB 2.0 Extender

Explanation:

The Wireless USB 2.0 Extender is a USB component that enables a computer to connect to and communicate with other computers on a network, or even to connect to the internet.

It uses an IEEE 802.11g radio platform and communicates within a radio frequency range of 2.4GHz.

Therefore, in cases where a notebook computer does not have a built-in wireless LAN card or PC card interface, you can use the Wireless USB 2.0 Extender as the best solution to that problem.

3 0
3 years ago
you have an ipv4 network that has two IPv6-only hosts that need to be able to communicate with each other. You want to implement
Soloha48 [4]

Answer:

Teredo tunnelling

Explanation:

The tunnelling method that will fit best in the situation is teredo tunnelling. The reason are embedded in its characteristics, they include;

Teredo tunneling has the following characteristics: Its tunnel endpoints are configured on hosts. The hosts are dual stack hosts and perform tunneling of ipv6 to send on the ipv4 network works through NAT the only solution that allows ipv4-only hosts to communicate with ipv6-only hosts is NAT-PT.

7 0
3 years ago
The Electronic Age began in the<br> A. 1940s<br> B. 1970s<br> C. 1980s<br> D. 1990s
sergejj [24]

Answer:

1940

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • In a digital drawing program, when an object is highlighted, boxes appear at the sides and corners. These boxes can be grabbed a
    13·1 answer
  • The _____ text wrapping option wraps text around the object, with the text forming to the shape of the object.
    14·1 answer
  • What is an examlple of cyberbullying
    5·1 answer
  • You have just built a new system from scratch. you turn the computer on but the system boot fails and sounds a beep code. what m
    15·1 answer
  • The date June 10, 1960, is special because when it is written in the following format, the month times the day equals the year:
    6·1 answer
  • Random letter of the alphabet for Python coding
    11·2 answers
  • Page Up and Page Down keys fall under the ? keys category.
    14·2 answers
  • Which of the following is not a natural resource
    11·2 answers
  • A form of segmentation that is based on user usage rate, user status, purchase occasion, and benefits sought is _________.
    13·1 answer
  • What is 11x12x12x14x15x16
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!