Professional Documents
Culture Documents
Max Index and Value in Array
Max Index and Value in Array
h>
int main()
int i, max_index;
scanf("%f", &arr[i]);
max = arr[0];//start off assuming that the 1st element is the max
for (i = 0; i < 5; i++)//now compare it with the rest of the array, updataing the max all along
max = arr[i];
max_index = i;
return 0;