#include
void main()
{int age[]={5,7,9,8,2,3,1},i,j,k,s;
s=age[0];k=0;
for (i=1;i<7;i++)
{if(age[i]>s)
{ s=age[i];k=i;}
}
printf("数组age最大值为%d,下标为%d\n",s,k);
}
虽然有点。。。但是我认真改了改,有不少错误,给分啊。呵呵
#include
void main()
{int age[]={5,7,9,8,2,3,1},i,j,k,s;
s=age[0];k=0
for (i=1;i<8;i++)
{if(age[i]>s)
{ s=age[i];k=i;}
}
printf("数组age最大值为%d,下标为%d",&s,&k);
}