Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by Jasir ( 12 years ago )
import java.io.*;
import java.lang.*;
class SelectionSort
{
public static void main(String[] args)throws IOException
{
int limit = args.length;

int[] arr=new int[limit];

for(int i=0;i<limit;i++)
{
arr[i]=Integer.parseInt(args[i]);
}
for(int i=0;i<limit;i++)
{
for(int j=i+1;j<limit;j++)
{
if(arr[i]>arr[j])
{
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(int i=0;i<limit;i++)
System.out.print(arr[i]+" ");
}
}

 

Revise this Paste

Your Name: Code Language: