#include <stdio.h>

// Function to sort an array in ascending order
void sortArray(int arr[], int size) {
    int temp;
    // Loop through the array elements
    for (int i = 0; i < size - 1; i++) {
        // Compare each element with the next elements
        for (int j = i + 1; j < size; j++) {
            if (arr[i] > arr[j]) {
                // Swap the elements if they are out of order
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
    }
}

int main() {
    int arr[4]; // Fixed size array with 4 elements

    // Ask user to input 4 array elements
    printf("Enter the array elements: ");
    for (int i = 0; i < 4; i++) {
        scanf("%d", &arr[i]); // Read each element
    }

    // Call function to sort the array
    sortArray(arr, 4);

    // Print the sorted array
    printf("Sorted array: ");
    for (int i = 0; i < 4; i++) {
        printf("%d ", arr[i]); // Output each element
    }
    printf("\n");

    return 0;
}
