class Exchange
{
public static void main(String[] args)
{
int A[]={3,4,1,2,8};
System.out.println("Before Sorting :");
for(int i=0;i<A.length;i++)
{
System.out.print(" "+A[i]);
}
for(int i=0;i<A.length-1;i++)
{
for(int j=i+1;j<A.length;j++)
{
if(A[i]>A[j])
{
int tampung=A[i];
A[i]=A[j];
A[j]=tampung;
}
}
}
System.out.println("\nAfter Sorting : ");
for(int i=0;i<A.length;i++)
{
System.out.print(" "+A[i]);
}
System.out.println();
}
}//use "Exchange.java" for file name
Capture :
Ads 970x90
Sabtu, 03 Maret 2012
Exchange ( Java )
Editor
Aguez stw
Published
3/03/2012 01:31:00 PM
Related Posts
Load comments
Langganan:
Posting Komentar (Atom)