Penpenqt69
Addict
- Joined
- Jul 31, 2018
- Posts
- 36
- Reaction
- 3
- Points
- 79
- Age
- 24
Code:
public static void main(String[] args) {
// TODO code application logic here
int temp,j, small, ctr,x,y, input;
System.out.print("Enter Lenght: ");
Scanner In = new Scanner(System.in);
input = In.nextInt();
int myArray[] = new int[input];
System.out.println("Input Numbers");
for(x=0;x<input;x++){
myArray[x]=In.nextInt();
}
for(y=0;y<myArray.length;y++){
small = myArray[y];
ctr = y;
for(j=y+1;j<myArray.length;j++){
if(myArray[j]>small);{
small = myArray[j];
ctr = j;
}
}
temp=myArray[y];
myArray[y]=small;
myArray[ctr]=temp;
for(ctr=0;ctr<myArray.length;ctr++){
System.out.print(myArray[ctr]+" ");
}
System.out.println("");
}
}
}
OUTPUT:
Enter Lenght: 5
Input Numbers
6
7
12
3
5
5 7 12 3 6
5 6 12 3 7
5 6 7 3 12
5 6 7 12 3
5 6 7 12 3
Ang gusto ko pa sanang gawi is ma sort sya in ascending while showing kung ano yung na ta-transpose. kaso ganyan po lumalabas
please po help me to fix this. THANK YOU!!!!~