#include #include // Function to perform Bubble Sort void bubbleSort(int arr[], int n) { int i, j, temp; for (i = 0; i < n - 1; i++) { for (j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { // Swap adjacent elements temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } } int main() { int arr[50], n=50, i; for (i = 0; i < n; i++) arr[i]=rand()%50; // Display original array printf("Original array: "); for (i = 0; i < n; i++) printf("%d ", arr[i]); // Call the bubbleSort function bubbleSort(arr, n); // Display sorted array printf("\nSorted array: "); for (i = 0; i < n; i++) printf("%d ", arr[i]); printf("\n"); return 0; }