最大值的索引

来源:互联网 发布:广东省网络干部培训 编辑:程序博客网 时间:2024/05/22 10:05
/* Note:Your choice is C IDE */#include "stdio.h"main(){double a[10];int i;int u=0;double max;for(i=0;i<10;i++)scanf("%lf",&a[i]);max=a[0];for(i=1;i<10;i++) {if(max<a[i]) { max=a[i]; u=i;}}    printf("the max is %lf",max);    printf("and the suoyin of the max is %d\n",u);}

0 0