Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class InsertSort {
  5.  
  6.  
  7. public static void main(String[] args)
  8. {
  9.  
  10. System.out.println("INSERTION SORT :");
  11.  
  12. Scanner input = new Scanner(System.in);
  13.  
  14.  
  15. System.out.print("Въведете броя на елементите в масива :" );
  16. int n = Integer.parseInt(input.nextLine());
  17. System.out.println();
  18.  
  19. int[] mass = new int[n];
  20.  
  21. for (int count = 0; count < mass.length; count++)
  22. {
  23. int ind = count +1;
  24. System.out.printf("Въведете елемент [%d] на масива: ", ind);
  25. mass[count] = Integer.parseInt(input.nextLine());
  26. }
  27. System.out.println();
  28. System.out.print("НЕ- Сортирания масив е : ");
  29.  
  30. System.out.println(Arrays.toString(mass));
  31. System.out.println();
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement