Professional Documents
Culture Documents
OVERVIEW:
In the program below we’re implementing the bubble sort algorithm using
array.
CODE:
#include <stdio.h>>
int main()
int arr[100];
int N;
printf("Enter no. of elements you want to insert within the range of 100 : ");
scanf("%d", &N);
input(arr, N);
bubblesort(arr, N);
printArray(arr, N);
return 0;
int i;
else
scanf("%d", &array[i]);
}
}
return array;
int c,d,swap;
swap = array[d];
array[d] = array[d+1];
array[d+1] = swap;
return array;
}
int i;
SAMPLE OUTPUT:
If more than 100 elements are to be inserted the program stops.
If less than 100 elements are inserted in any order the sorted array is
returned and printed.