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
andreyandreev [35.5K]
3 years ago
5

Write a program that gets a list of integers from input, and outputs the integers in ascending order (lowest to highest). The fi

rst integer indicates how many numbers are in the list. Assume that the list will always contain less than 20 integers.Ex: If the input is 5 10 4 39 12 2, the output is: 2 4 10 12 39Your program must define and call the following method. When the SortArray method is complete, the array passed in as the parameter should be sorted.
Computers and Technology
1 answer:
Travka [436]3 years ago
5 0

Answer:

Explanation:

Since no programming language is stated, I'll use Microsoft Visual C# in answering this question.

// C# program sort an array in ascending order

using System;

class SortingArray {

int n; //number of array elements

int [] numbers; //Array declaration

public static void Main() {

n = Convert.ToInt32(Console.ReadLine());

numbers = new int[n];

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

{

numbers [n] = Convert.ToInt32(Console.ReadLine());

}

SortArray();

foreach(int value in numbers)

{

Console.Write(value + " ");

}

}

void SortArray()

{

int temp;

// traverse 0 to array length

for (int i = 0; i < numbers.Length - 1; i++)

// traverse i+1 to array length

for (int j = i + 1; j < numbers.Length; j++){

// compare array element with all next element

if (numbers[i] < numbers[j])

{

temp = numbers[i];

numbers[i] = numbers[j];

numbers[j] = temp;

}

}

}

You might be interested in
Select all that apply.
VARVARA [1.3K]

You can move one cell to the right by using the Tab key.

8 0
3 years ago
Which option helps you choose the design of a slide in a presentation?
stich3 [128]

Answer:

What are the options?

Explanation:

4 0
3 years ago
Read 2 more answers
What do you call when a hacker users multiple guest computers to crack a password?
azamat

Answer: Botnet

Explanation:

Botnet is the process when a hacker user uses multiple guest computer to crack a password. Basically, hackers use botnet for performing the distributed denial of services attack in the network.

It also steal the data and allowed attacker to approach its connection and access its device.

Botnet word is the combination of robot and network and botnet can be controlled by using the command and control software.

6 0
3 years ago
Which social media platform provides filters that alter the user's face by smoothing and whitening skin, changing eye shape, nos
Olegator [25]

Answer: Snap-chat

Explanation:

is a social media platform application developed for mainly sharing of photos with the use of some special filters which are able alter how the person looks. examples of such filters are filters that alter the user's face, smoothing and whitening the users skin, changes the eye shape of the user, alters the nose size and jaw profile of the individual using the app. Snap chat has become a photo favorite for many young people today and celebrities alike.

5 0
3 years ago
Write a function merge that merges two lists into one, alternating elements from each list until the end of one of the lists has
Anna007 [38]

Explanation:

The program that merges two lists or two arrays is written below;

Code :

void main void

{

char [] arr1= {'1','2','3'};

char [] arr2= {'a','b','c','d','e'};

int l1= arr1.length;

int l2=arr2.length;

int l3=l1+l2;

char [] arr3=new char[l1+l2];

int i=0;

int j=0;

int k=0;

int m=0;

int r=0;

if(l1<l2)

   r=l1;

else

   r=l2;

while(m<r)

{

   arr3[k++]=arr1[i++];

   arr3[k++]=arr2[j++];

   m++;

}

while(k<l3)

{

   if(l1<l2)

       arr3[k++]=arr2[j++];

   else

       arr3[k++]=arr1[i++];

}

for(int n=0;n<l3;n++)

{

   System.out.print(arr3[n]+" ");

}

}

5 0
3 years ago
Other questions:
  • Stock ____ firms trade financial securities between a buyer and a seller.
    11·1 answer
  • A researcher wants to do a web-based survey of college students to collect information about their sexual behavior and drug use.
    15·1 answer
  • Q1: Which of the following is an input peripheral device?
    12·2 answers
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • 1. Select the Volatile Memory *
    8·1 answer
  • Ania has written this SimpleStopwatch class. In which line is she measuring the elapsed time?
    13·1 answer
  • Um ok that makes sooo much sence
    11·2 answers
  • JAVA- If you have an int as the actual parameters, will it change to fit the parameters if it requires a double, or will the cod
    15·1 answer
  • Explain how loops can be utilized in list processing. Please provide Python examples in your response.
    7·1 answer
  • Inheritance enables an object, called a _____, to derive one or more of its attributes from a parent.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!