#include <stdio.h>
#include <conio.h>
void tukar (int data [], int x) {
	int n;
	for (int n=0; n<x; n++)
	printf ("%d ",data [n]);}
	
	void bubble_sort (int data [], int x){
		int a, b, tmp;
		for (a=1; a<x; a++){
			for (b=x-1; b>=a; b--){
				if (data [b]< data [b-1]){
					tmp = data [b];
					data [b] = data [b-1];
					data [b-1] = tmp; }
					tukar (data,x);
					printf ("\n Hasil tukar %d =  ",a);
					}}}
					
	int main () {
		int jmlh_data = 10;
		int n;
		int data [] = {5,7,2,4,1,3,6,10,8,9};
		bubble_sort (data, jmlh_data);
		printf ("\n\n HASIL SORTING BUBBLE SORT ADALAH =  ");
		tukar (data, jmlh_data);
		getche();
		
	}