int max;//接收最大值 int arr[n];//n为输入的整数的个数 int i;max=arr[0];for(i=0;i<n-1;i++){ scanf("%d",arr[i]);//输入前n-1个数 } arr[i]=-1;//以-1结束 for(i=0;i!=1n;i++){ if(arr[i]>max) max = arr[i];//求最大值 } 这是核心语句,我希望...
cout<<"最大整数:"<<max<<"\n最小整数:"<<min<<endl;}
include <stdio.h> include <stdlib.h> int main(){int max,min,num;printf("Input numbers,-1 to end:\n");scanf("%d",&num);max=min=num;while(num!=-1){ if(num>max)max=num;if(num<min)min=num;scanf("%d",&num);} printf("max:%d,min:%d\n",max,min);system("pause...
begin n:=0;while n<>-1 do begin read(n);if n>ans then ans:=n;end;writeln(ans);readln;end.