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]
4 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]4 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
Which actions changed the look of the following word?
jarptica [38.1K]

Answer:

D

Explanation:

The actions applied to change the look of the word are:

1. It was set to italics. This can be done easily by highlighting the word => press Ctrl + I together on the keyboard.

2. Next is to set to underline. While still highlighted => press Ctrl + U together in the keyboard.

6 0
3 years ago
Read 2 more answers
The concept of algorithm ____, is one in which you can observe an algorithm being executed and watch as data values are dynamica
Yakvenalex [24]
The answer to this question would be algorithm animation.

Since the algorithm is animate, then you will be able to watch it works. Watching the algorithm executed can give you much information, what the algorithm does and how the algorithm does it.
Normally you will not be able to do this since the algorithm only do what it needs to do without reporting the detail to you
4 0
3 years ago
To open the format cells dialog box with the alignment sheet active, tap or click the alignment settings ____.
Otrada [13]
<span>To open the format cells dialog box with the alignment sheet active, tap or click the alignment setting button
</span>
3 0
4 years ago
Send me friend rq ;)
kondaur [170]

Answer:

shore

Explanation:

4 0
3 years ago
Read 2 more answers
a program p takes time proportional to log where nlogn is the input size. if the program takes 100 ms to process input of size 1
Eddi Din [679]

Answer:

The time is 4 \times 10^7 \ microseconds.

Explanation:

\ The \ requires \ time \ be \ t \ microseconds, \\\\\ \ formula: \\\\ time \propto \ nlog_n \Rightarrow \ time \ = \ knlogn \\\\

\ 10 \ = \ 100 \ log(100) \ \ \ \ \ \ \ \ \ k= 10^2 \ log\ ( \ 10^2\ ) \ k\\\\t=100,000,000 \log \ ( \ 100,000,000\ ) \ k = \ 10^8 \ log\ (\ 10^8\ )\ k \\\\\rightarrow \frac{t}{10} \ =\frac{10^8\ log \ (10^8)k}{10^2\ log\(10^2\ ) k} \\\\\rightarrow \frac{t}{10} \ =\frac{10^8\ log \ (10)\times 8 \times k}{10^2\ log\(10) \times 2 k} \\\\\rightarrow \frac{t}{10} \ =\ 4\times 10^6\\\\\rightarrow \ t \ =\ 4\times 10^6 \times 10 \\\\\rightarrow \ t \ =\ 4\times 10^7 \ microseconds \\\\

3 0
4 years ago
Other questions:
  • Your new home has a vacuum system. what kind of computer is controlling it?
    5·1 answer
  • Write a C or C program A6p2.c(pp) that accepts one command line argument which is an integer n between 2 and 4 inclusive. Genera
    9·1 answer
  • 5. Write a 500- to 1,000-word description of one of the following items or of a piece of equipment used in your field. In a note
    13·1 answer
  • PLEASE HELP ON TECHNOLOGY
    8·1 answer
  • What general (system) recommendations might you make to the shop manager? (For example. if the system will be integrated, what m
    13·1 answer
  • You are an IT technician at your company. The company has two small offices in different cities. The company's head office conta
    5·1 answer
  • Why is an array like a list? How do you identify and find elements in an array? Explain the purpose of a try-catch block and giv
    5·1 answer
  • What happen if file server stops working?
    5·1 answer
  • Match each role to the corresponding web development task.
    14·1 answer
  • How could each of the two-proposed changes decrease the size of an mips assembly program? On the other hand, how could the propo
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!