Java

Java - Number Ascending Order Program

Java - Number Ascending Order Program
class asc 
{ 
public static void main(String arg[]) 
{ 
int a[] = {4,2,1,3,7}; 
int i,j,t; 

for(i=0;i<5;i++) 
{ 
for(j=i+1;j<4;j++) 
{ 
if (a[i]>a[j]) 
{ 
t = a[i]; 
a[i] = a[j]; 
a[j] = t; 
} 
} 
} 

for(i=0;i<5;i++) 
{ 
System.out.println(a[i]); 
} 

} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.