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
Shalnov [3]
3 years ago
12

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:
Alja [10]3 years ago
6 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:

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

Hope this helps!

You might be interested in
In a relational database, the three basic operations used to develop useful sets of data are:_________.
olga_2 [115]

In a relational database, the three basic operations used to develop useful sets of data are:

\sf\purple{a.\: Select, \:project,\: and\: join. }

\large\mathfrak{{\pmb{\underline{\orange{Mystique35 }}{\orange{❦}}}}}

6 0
3 years ago
_____ consists of computer programs that govern the operation of a computer.
telo118 [61]
Hello <span>Siyujiang8092</span>

Answer: Software<span> consists of computer programs that govern the operation of a computer.

Hope that helps
-Chris</span>
6 0
4 years ago
What is the service provided by a third party (such as an ISP) that enables you to connect another cloud directly to your Google
Olenka [21]

Answer:

A. Dedicated interconnect

Explanation:

With dedicated interconnect, there is a direct connection between your network and that of Google. It enables you to connect another cloud directly to your Google cloud resources to create hybrid cloud solutions. In other words, Dedicated Interconnect enables hybrid networking. Businesses can now extend their own private cloud into Google's cloud so they can switch control between the two with little latency. This gives them (businesses) control over the amount of data entering into the two clouds.

8 0
4 years ago
Connect research concepts to their definitions
stellarik [79]
Answer Research is defined as the creation of new knowledge and/or the use of existing knowledge in a new and creative way so as to generate new concepts, methodologies and understandings
8 0
2 years ago
Why are most minicomputers no longer used​
Svet_ta [14]

Answer:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Explanation:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as sma

7 0
4 years ago
Other questions:
  • Inherent flaws in system software code are called:
    7·1 answer
  • Write a recursive function that takes a non-negative integer as an argument and displays the same number in reverse order (i.e.
    15·1 answer
  • When seeking information on the internet the most helpful place to look is?
    14·2 answers
  • Explain each of the three important concepts behind the Federal Networking Council's definition of the term Internet. Explain ho
    8·1 answer
  • Given the variable ip, already declared as a pointer to an integer, write the code to dynamically allocate memory for a single i
    15·1 answer
  • public class Ex0506 { public static void main (String args[]) { int x = 2; while (x &lt; 10) { if (x % 2 == 0) x+=3; else x+=2;
    15·1 answer
  • Why is know app downloading in my android phone even if I have 900 MB ???
    8·2 answers
  • Tightly.
    5·1 answer
  • 10. Question<br> What are the drawbacks of purchasing something online? Check all that apply.
    5·1 answer
  • Computing is the provision of IT services on demand.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!