public class Sort{
public static void main(String[] args){
int[] nums = {1, 3, 4, 6, 2, 5};
for (int i=0;i<nums.length;i++){
for (int j=0;j<i;j++){
if (nums[j]>nums[j+1]){
int temp = 0;
temp=nums[j];
nums[j]=nums[j+1];
nums[j+1]=temp;
}
}
}
for (int i=0;i<nums.length;i++){
System.out.println(nums[i]);
}
}
}
package main
impost "fmt"
func main() {
var nums = []int{1, 6, 2, 5, 3, 4}
for i := 0; i < len(nums); i++ {
for j := 0; j < i; j++ {
if nums[j] > nums[j+1] {
var temp int
temp = nums[j]
nums[j] = nums[j+1]
nums[j+1] = temp
}
}
}
for i := 0; i < len(nums); i++ {
fmt.println(nums[i])
}
}