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
Using selection sort, how many times longer will sorting a list of 40 elements take compared to a list of 5 elements
Hoochie [10]

It will take 8 times more time to sort a 40-element list compared to the time spent on a 5-element list.

We can arrive at this answer as follows:

  • We can see that if we divide a group of 40 elements into groups containing 5 elements, we will have 8 groups.
  • In this case, the time it would take to sort the list of one group of 5 elements would be repeated 8 times so that we could sort all the groups and their elements.

Another way to do this is to divide the number 40 by 5. We would have the number 8 as a result, which indicates that we would need 8 times more time to sort a list of 40 elements, compared to a list of 5 elements.

You can get more information about lists at this link:

brainly.com/question/4757050

5 0
3 years ago
A network using multiple cell towers falls under which type of network?
erastova [34]

Answer:

man

Explanation:

multiple area network

8 0
4 years ago
1) What is Net beans
Bingel [31]

Answer:

it's a software

Explanation:

NetBeans IDE lets you quickly and easily develop Java desktop, mobile, and web applications, as well as HTML5 applications with HTML, JavaScript, and CSS. The IDE also provides a great set of tools for PHP and C/C++ developers.

5 0
3 years ago
Web browsers are used to browse the world wide web.
VikaD [51]
No its actually used for looking up concerns, questions, or rumours
3 0
4 years ago
Read 2 more answers
Oliver is creating anime using a less popular, traditional tool to create the style anime is known for. Which tool is Oliver usi
Makovka662 [10]
I think it might be c or b
5 0
3 years ago
Read 2 more answers
Other questions:
  • . A technology professional keeping up-to-date on current developments may find it valuable to
    13·1 answer
  • .When an argument is passed ______________, the called method can access and modify the caller’s original data directly.
    8·1 answer
  • You recently set up a DHCP server and need to configure your computer to start using it. Click the IPv4 properties option that y
    10·1 answer
  • Does anyone know any nitro type hack??
    13·2 answers
  • Match the items with their respective descriptions.
    6·2 answers
  • Ben is writing web page content on a newly launched gaming gadget. He has to use hyperlinks to help visitors navigate to web pag
    11·1 answer
  • Why vechiles Tyres are black in colour?​
    14·1 answer
  • PLEASE HELP ILL MARK BRAINLIEST!!!
    10·1 answer
  • The first cell phones in widespread use were . Smartphone technological advancements added services. Answer the following questi
    12·2 answers
  • 4. Cash inflows from investing activities normally arise from all of the following EXCEPT
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!