/* LightCollege.ir Learc C Programing*/
#include<stdio.h>
void ShowArr(int arr[],int size);
void bubbleSort(int n[],int size);

void main(){
	int arr[10] = { 64, 34, 25, 12, 22, 11, 90, 36, 75, 20 };
	printf("Before Sort : ");
	ShowArr(arr,10);
	printf("After Sort : ");
	bubbleSort(arr,10);
	ShowArr(arr,10);
}

void bubbleSort(int n[],int size){
	int i,j;
	for(i=0;i<size;i++){
		/* sort */
		for(j=0;j<size-1-i;j++){
			if(n[j] > n[j+1]){
				int hold = n[j];
				n[j] = n[j+1];
				n[j+1] = hold;
			}
		}
		/* end sort */
	}
}


void ShowArr(int arr[],int size){
	int i;
	for(i=0;i<size;i++){
		printf("%5d",arr[i]);
	}
	printf("\n");
}
/*power by LightCompany.ir*/
