Q:

Java - Number Ascending Order Program

0

This Program is used to calculate Ascending Order Program using Number Ascending Order Program.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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]); 
} 

} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now