Created
November 22, 2015 10:04
-
-
Save dheshanm/0db6b5366154cb8246c9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 tutorials.Next; | |
| import java.util.Scanner; | |
| /** | |
| * Created by Dheshan M (@D-codex) on 10/26/2015. | |
| */ | |
| public class AscendingOrder { | |
| public static void main(String Args[]) { | |
| int i,j; | |
| int temp; | |
| int name[]=new int[10]; | |
| Scanner in=new Scanner(System.in); | |
| System.out.println("Enter the Names to be Sorted :"); | |
| for(i=0;i<10;i++){ | |
| name[i]=in.nextInt(); | |
| } | |
| System.out.println("___________________________________________________\nSorted List\n"); | |
| for(i=0;i<9;i++){ | |
| for(j=(i+1);j<10;j++){ | |
| if(name[i]>name[j]){ | |
| temp=name[i]; | |
| name[i]=name[j]; | |
| name[j]=temp; | |
| } | |
| } | |
| } | |
| for(i=0;i<10;i++){ | |
| System.out.println(name[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment