C语言程序:
#include "stdio.h"
#define N 10
void main()
{
double arr[N];
int i, k;
double max;
printf("请输入 %d 个实数:", N);
for(i=0; iscanf("%lf", &arr[i]);
max = arr[0];
for(i=1; iif(arr[i] > max)
{
max = arr[i];
k = i;
}
printf("数组元素列表:");
for(i=0; iprintf("%lf ", arr[i]);
printf("\n最大值:%lf,下标:%d\n", max, k);
}
int main()
{
int a[10],loop,*tmp,b,c;
printf("please input 10 num:\n");
for(loop = 0,tmp = &a[0];loop < 10;loop++)
{
scanf("%d",tmp);
tmp++;
}
for(loop = 0,b =a[loop];loop < 10;loop++)
{
if(b < a[loop])
{
b = a[loop];
c = loop;
}
}
printf("The max num is %d,and the index is %d",b,c);
return 0;
}