Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int min_index(double *array, int size)
- {
- double min = array[0];
- int index = 0;
- for(int i = 0 ; i != size ; ++i)
- {
- if(array[i]<min)
- {
- min = array[i];
- index = i;
- }
- }
- return index;
- }
- int main()
- {
- double array[14]= {0.1,-25.2,0,888.35,
- -424.48,0,15,-7,-195,2,
- 0,0.04,-15.2,57.6};
- int n = 14;
- printf("min index = %d\n",min_index(array,n));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement