灰烬之希望之光
回答数:144 | 被采纳数:95
#include <iostream>using namespace std;int main(){int a,max,min;cin>>a;max=a;min=a;for(int i=1;i<=4;i++){cin>>a;if(a>max)max=a;if(a<min)min=a;}cout<<"min="<<min<<endl<<"max="<<max<<endl;return 0;}
#include <stdio.h>intmain(){inta[5]={0},i,max,min;for(i=0;i<5;i++){scanf("%d",&a[i]);}max=min=a[0];for(i=0;i<5;i++){if(maxa[i])min=a[i];}printf("max=%d,min=%d\n",max,min);return0;}希望能帮助到您,谢谢,望采纳!