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
PLEASE HELP ME!!!!
White raven [17]
The answers are D and A
5 0
3 years ago
Read 2 more answers
Why we use cluster computing and hadoop framework for big data sysetm​
Ber [7]

Answer:

Explanation:

Hadoop clusters can boost the processing speed of many big data analytics jobs, given their ability to break down large computational tasks into smaller tasks that can be run in a parallel, distributed fashion.

5 0
2 years ago
Which option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
Rasek [7]
Are you talking about word processors? If yes, you can edit a document's header and footer so the change reflects on all pages of the document.
3 0
3 years ago
Automatic weights are assigned based on which of the following?
svetlana [45]

Answer:

Im 90% sure it's D

Explanation:

3 0
4 years ago
What makes smartphones so fragile?
In-s [12.5K]
Glass screen probably
7 0
3 years ago
Other questions:
  • Write a function listLengthOfAllWords which takes in an array of words (strings), and returns an array of numbers representing t
    14·1 answer
  • What are the TWO methods of copying and pasting on the AutoCAD Clipboard function?
    7·1 answer
  • Arrange the steps in a sequence that you would follow while sorting data in a spreadsheet.
    12·1 answer
  • Columns are most useful for which tasks ?
    12·1 answer
  • What is the problem with the code snippet below? public class Test { public static void main(String[] args) { System.out.println
    6·1 answer
  • Do you see traffic flowing from the internet into your system or from your network to the internet? explain why or why not:
    6·1 answer
  • Create a program that calculates the tip and total for a meal at a restaurant. Type the code into an IDLE IDE editor window and
    5·1 answer
  • These operating systems use a graphical user interface.
    8·1 answer
  • LIST THE BEST 10 3D PRINTERS WITH THEIR RESPECTIVE APPS.
    14·1 answer
  • Which company provides a crowdsourcing platform for corporate research and development?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!