#include <stdio.h>

// 求数组最大值
int getMax(int arr[], int len) {
    int max = arr[0];
    for (int i = 1; i < len; i++) {
        if (arr[i] > max) max = arr[i];
    }
    return max;
}

// 求数组最小值
int getMin(int arr[], int len) {
    int min = arr[0];
    for (int i = 1; i < len; i++) {
        if (arr[i] < min) min = arr[i];
    }
    return min;
}

int main() {
    int nums[] = {12, 45, 7, 99, 33, 61};
    int length = sizeof(nums) / sizeof(nums[0]); // 计算数组长度
    
    int max = getMax(nums, length);
    int min = getMin(nums, length);
    
    printf("数组元素：");
    for (int i = 0; i < length; i++) {
        printf("%d ", nums[i]);
    }
    printf("\n最大值：%d，最小值：%d\n", max, min);
    return 0;
}
