Created
February 1, 2017 11:23
-
-
Save User0111/87dc239355fb5f46077018049330072d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
public class Main { | |
public static void main(String[] args) { | |
int i,j,tm = 0; | |
int n=0; | |
int arr1[] = {12, 14, 5, 80, 8, 16, 40}; | |
for(j=0;j<arr1.length;j++){ | |
n++; | |
for (i = 0; i < arr1.length-n; i++) { | |
if (arr1[i] > arr1[i + 1]) { | |
tm = arr1[i + 1]; | |
arr1[i + 1] = arr1[i]; | |
arr1[i] = tm; | |
} | |
} | |
} | |
for(i=0;i<7;i++){ | |
System.out.println(arr1[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment