Question: import java.util. * ; / * file name must be sortList because class is public * / public class sortList { public static void main

import java.util.*;
/*file name must be sortList because class is public*/
public class sortList
{
public static void main(String[] args)
{
/*Scanner to read input*/
Scanner read=new Scanner(System.in);
int size,i;
/*read size from user*/
System.out.print("Enter the size of the list: ");
size=read.nextInt();
/*declare list*/
int[] list=new int[size];
/*read numbers to the list*/
System.out.println("Enter the numbers in the list:");
for (i=0;ilist1[j])
{
/*swapping*/
int temp=list1[i];
list1[i]=list1[j];
list1[j]=temp;
}
}
}
/*count variable*/
int c=0;
for (i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!