求最大值及其下标
#include<stdio.h>
int main()
{
int a[10],i,b,n;
scanf("%d",&n);
for(b=0;b<n;b++){
scanf("%d",&a[b]);
}
for(i=b=0;b<n-1;b++){
if(a[i]<a[b+1]){
i=b+1;
}
}
printf("%d %d",a[i],i);
return 0;
}
思维导图链接: https://www.edrawsoft.cn/viewer/public/s/96580997556398