public class array{
public static void main(String[] args){
int num[] = {80,20,47,82,25,13};
int l = num.length;
int i,j;
System.out.print("Given number : ");
for (i = 0;i < l;i++ ){
System.out.print(" " + num[i]);
}
System.out.println("\n");
System.out.print("Accending order number : ");
for (i = 0;i < l;i++ ){
//int temp=num[i];
for (j = 0;j < l;j++ ){
if(num[i]>num[j])
{
num[i]=num[j];
}
}
}
for (i = 0;i < l;i++ ){
System.out.print(" " + num[i]);
}
}
}
output is coming wrong....
Given number : 80 20 47 82 25 13
Accending order number : 13 13 13 13 13 13