#include<stdio.h> #include<string.h> int main() { char arr[10]={8,12,14,12,12,15,15,5,6,7}; char arr1[10]={8,12,14,12,12,15,15,5,6,7}; int max; int min; int i,j,k; for(i=0;i<9;i++) { j=i+1; if(arr[i]>arr[j]) { max=arr[i]; arr[j]=arr[i]; } } for(k=0;k<9;k++) { if(arr1[k]<arr1[k+1]) { min=arr1[k]; arr1[k+1]=min; } } printf("max= %d\n",max); printf("min= %d\n",min); }
时间: 2024-10-23 15:51:28