Advertisement
bobo_bobkata

Untitled

Oct 10th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public static void main(String[] args) {
  2. int[] mas = {35, 5, 98, 1, 76, 3};
  3.  
  4. for (int i = 0; i <= mas.length - 1; i++) {
  5. for (int j = 1; j <= mas.length - 1 - i; j++) {
  6. if (mas[j - 1] > mas[j]) {
  7. int temp = mas[j - 1];
  8. mas[j - 1] = mas[j];
  9. mas[j] = temp;
  10. }
  11. }
  12. }
  13.  
  14. for (int i = 0; i <= mas.length - 1; i++) {
  15. System.out.print(mas[i] + " ");
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement