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
r packages include sample datasets. they also include reusable r functions and documentation about how to use the functions. Tru
Dvinal [7]

r packages include sample datasets. they also include reusable r functions and documentation about how to use the functions.

The above statement is <u>True</u>.

What are R packages?

<u>The statistical programming language R has extensions </u>known as R packages. Users of R can install R packages by <u>accessing a centralized software repository like CRAN</u>, which often contains code, data, and documentation in a common collection format.

The "library" directory is <u>where R </u><u>packages </u><u>are kept in the R environment</u>. During installation, R automatically install a number of packages. Later, when additional packages are required for a particular task, they are added.

To learn more about R packages, use the link given
brainly.com/question/26125959
#SPJ4

7 0
9 months ago
An individualized course plan for the 4 years of
spin [16.1K]

Answer:

.....

Explanation:

8 0
2 years ago
Read 2 more answers
Is mmorpg an example of virtual community
Inga [223]
Yes I would say it is.
4 0
3 years ago
Read 2 more answers
Do you think Google has an unfair advantage as a social media marketing platform? Explain.
Bond [772]
In some aspects, yes but these have recently been outweighed with the ad boycott youtube has not to mention google plus wasn't the most popular, to begin with, but in an overall sense yes as the name google is more often used than Facebook or twitter
3 0
2 years ago
Read 2 more answers
What is an icon or animation used to represent aparticipant in an internet chat referred to as?
Veronika [31]
Emoji is an icon or animation used to represent a participant in an internet chat.
8 0
3 years ago
Other questions:
  • Which is the most important reason you should properly cite information that you obtain from an Internet search? Question 2 opti
    8·1 answer
  • A ________ is s field or set of fields in a record that uniquely defines the record.
    7·1 answer
  • You want to enable nap so that all portal computers using wireless connections have an active firewall. which type of enforcemen
    11·1 answer
  • One study found that nearly ____________ of the 1600 college freshmen surveyed had sent sexually suggestive texts or photos.
    11·1 answer
  • Use the following global structure declaration as an example only. You will need to create your own data structure based on a da
    5·1 answer
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • Which if the following is an effect of intellectual property theft?
    6·2 answers
  • _____ creates a border or space that separates information.
    14·1 answer
  • Concerning Structured Cabling, select the statement that is true, or select, "All statements are false."
    5·1 answer
  • A student is browsing a website. While browsing, he click on a link that takes him to another website. Which code gives the corr
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!