Computer Science, asked by adityas15593, 11 months ago


To sort an array using bubble sort technique. ​

Answers

Answered by irakhedkar
2

//bubble sort 1

class BubbleSort{

public static void main(String args[]){

 int num[] = {4,2,7,8,5,9,1,6,11,45};

 int tempo;

 for(int i = 0; i < 10 - 1; i++){

  for(int j = i + 1; j < 10; j++){

   if(num[i]>num[j]){

    tempo = num[i];

    num[i] = num[j];

    num[j] = tempo;

   }

  }

 }

 for(int i = 0; i < 10; i++){

   System.out.println(num[i]);

  }

}

}

Hope this helps,

ira.

(would like to get the brainliest crown)

Similar questions