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
zmey [24]
4 years ago
13

Write a function that, given an array of integers and its size, reverses the elements in the array. For example, if the original

array was [10, 15, 5, 25, 0] the new array should be [0, 25, 5, 15, 10].
Computers and Technology
1 answer:
Mrac [35]4 years ago
8 0

Answer:

import java.util.Arrays;

public class num11 {

   public static void main(String[] args)

   {

       int [] originalArray = {10, 15, 5, 25, 0};

       System.out.println("Original Arrays is: "+Arrays.toString(originalArray));

       reverseArray(originalArray, originalArray.length);

   }

//Method reverseArray

  public static void reverseArray(int a[], int n)

   {

       int[] newArray = new int[n];

       int m = n;

       for (int i = 0; i < n; i++) {

           newArray[m - 1] = a[i];

           m--;

       }

      #Printing the Reverse

       System.out.println("The Reversed Array is "+Arrays.toString(newArray));

   }

}

Explanation:

Using Java programming language:

The method is created to accept two parameters (an array and its size)

Create a new array within the method int[] newArray = new int[n];

Using a for loop iterate over the original array and place each of its elements in the new array from the last index, this places the elements reversively.

Use Java's toString() to display the revesered Array

You might be interested in
Here is the list of problems to choose from:
olya-2409 [2.1K]

Answer:

There's a parking lot that is 600m² big. The lot must be able to hold at least 3 buses and 10 cars.

Each car takes up 6m² and each bus takes up 30m².

However, there can only be 60 vehicles in the lot at any given time.

The cost to park in the lot is $2.50 per day for cars and $7.50 per day for buses. The lot must make at least $75 each day to break even.

What is a possible car to bus ratio that would allow the lot to make profit?

3 0
3 years ago
The procedure by which a process's state is saved before being swapped out of the cpu, then us restored to the state when the pr
belka [17]

The procedure is known as<u> context switching</u>.

In the field of computers, context switching can be described as a procedure in which a process is stored so that it can be executed at a later point. Such a procedure allows multitasking operations easier. A simple CPU can be utilized for multiple processes.

After a task is done, it can be swapped out of the CPU and can be restored later. By using context switching, more space can be provided on a CPU as freeing from one process will make space for the other.

When switching a process, the status of the older running process is saved on the CPU as registers.

Context switch makes it feasible to share one CPU for multiple procedures hence reducing the concerns that arise from using additional processors.

To learn more about context switch, click here,

brainly.com/question/21685677

#SPJ4

3 0
2 years ago
Qual parâmetro é usado é usado na query sql para a presentar os dados em ordem decrescente?Leitura Avançada
nikitadnepr [17]

Answer:

gg

Explanation:

gg

4 0
3 years ago
True / False<br> Branch instructions are one technique for preventing instruction pipeline stalls.
VashaNatasha [74]

Answer:False

Explanation: Pipeline architecture works in a way where the processing or execution of one stage is done and then processes instruction in the next stage in a sequence to achieve the good performance of program. But due to conditional branching the stalls are caused which creates error and the program has to restart from different node because sequence get disrupted.Therefore the statement given is false.

7 0
3 years ago
If you are connected to a network that uses DHCP, and you need to terminate your Windows workstation's DHCP lease, which command
FromTheMoon [43]

Answer:

IP config/release

Explanation:

6 0
2 years ago
Other questions:
  • A. True
    14·2 answers
  • How is sharepoint used in organization today?
    12·1 answer
  • a.Write a Python function sum_1k(M) that returns the sumí‘ í‘ = ∑1푘푘푀푀푘푘=1b.Compute s for M = 3 by hand and write
    15·1 answer
  • Where does a computer store it’s information
    11·1 answer
  • Jim is writing a program to calculate the wages of workers in a teddy bear factory.
    7·1 answer
  • How much is a stock supra 1998​
    15·1 answer
  • Why do you think that network and telecommunications security careers are some of the fastest growing in the field of technology
    8·1 answer
  • What does Al stand for?
    10·1 answer
  • Answer if you know Javascript, html, css, python, and Ruby.
    12·1 answer
  • Identify the three fuzzy logic systems in the given text.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!