求一组数中的最大值及其位置。例如:数据为:2 7 34 4 23 56 10 45。最大值应为:56 位置应为:6.
数组求大小用for循环啊,位置就是找出下标呗
不知道你这个问题是否已经解决, 如果还没有解决的话:#include <stdio.h>
#include <math.h>
int IsTheNumber ( const int N );
int main()
{
int n1, n2, i, cnt;
scanf("%d %d", &n1, &n2);
cnt = 0;
for ( i=n1; i<=n2; i++ ) {
if ( IsTheNumber(i) )
cnt++;
}
printf("cnt = %d\n", cnt);
return 0;
}
/* 你的代码将被嵌在这里 */