answersLogoWhite

0


Best Answer

Your best bet would probably be to iterate through the array using a for loop and compare each value to the current low and high values (which you would store in a local variable)

for example:

for each element in array

{

if current is less than lowest_value

lowest_value = current

else if current is greater than highest_value

highest_value = current

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

#include <stdio.h>

int main()

{

int array[100], smallest, size, c, location = 1;

printf("Enter the number of elements\n");

scanf("%d",&size);

printf("Enter %d integers\n", size);

for ( c = 0 ; c < size ; c++ )

scanf("%d", &array[c]);

smallest = array[0];

for ( c = 1 ; c < size ; c++ )

{

if ( array[c] < smallest )

{

smallest = array[c];

location = c+1;

}

}

printf("Smallest element is present at location %d and it's value is %d.\n", location, smallest);

getch();

return 0;

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

I look for the array element that contains the smallest value.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the minimum value of an array in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to find max and min values?

Find the minimum and maximum of what? An array?


How do you find max value out of anonymous array in java?

java is very most important language in computer field. .net is also useful


How do you find the minimum value?

algebra


The minimum number of comparisons requied to find the second smallest element in a 1000 element array is?

1010


Write a c program to find the maximum value of 25 element in an array?

int findMax(int *array) { int max = array[0]; for(int i = 1; i &lt; array.length(); i++) { if(array[i] &gt; max) max = array[i] } return max; }


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you find minimum and maximum value of calculus?

In Calculus, to find the maximum and minimum value, you first take the derivative of the function then find the zeroes or the roots of it. Once you have the roots, you can just simply plug in the x value to the original function where y is the maximum or minimum value. To know if its a maximum or minimum value, simply do your number line to check. the x and y are now your max/min points/ coordinates.


How can you get position of number from given some number by using array in c language?

Traverse the array from index 0 until you find the number. Return the index of that number.


How can we find Range in case of frequency distribution?

Range = Maximum value - Minimum value


How do you Find the highest (maximum) and lowest (minimum) grades in an array?

You can get many example of"c programming" Reference:cprogramming-bd.com/c_page1.aspx# integer grades


How can you write a c program to find minimum element in row of a matrix and subtract that row elements by that minimum element?

Assuming the matrix is two-dimensional, a single row would just be an ordinary array. To find the minimum element of an array, store the first element, then traverse the remainder of the array. If we find a value smaller than the stored value, replace the stored value. Once we have traversed the whole array, the stored value is the smallest value. We then traverse the array once more, subtracting that value from each element. The following C code shows how we might implement this for a matrix of doubles: #include&lt;stdio.h&gt; double array_min (double array[], size_t n) { double min= array[0]; for (size_t i=1; i&lt;n; ++i) if (array[i]&lt;min) min=array[i]; return min; } void subtract (double array[], size_t n, double value) { for (size_t i=0; i&lt;n; ++i) array[i] -= value; } void print_matrix (double * array[], size_t rows, size_t cols) { printf ("{"); for (size_t row=0; row&lt;rows; ++row) { printf ("{"); for (size_t col=0; col&lt;cols; ++col) printf ("%d, ", array[row][col]); printf ("\b\b}, "); } printf ("\b\b} \n"); } int main () { const size_t rows = 4; const size_t cols = 5; double matrix[rows][cols] = {{0.1, 0.2, 0.3, 0.4, 0.5}, {1.0, 0.9, 0.8, 0.7, 0.6}, {1.4, 1.5, 1.3, 1.1, 1.2}, {1.8, 1.7, 1.6, 2.0, 1.9}}; print_matrix (matrix, rows, cols); for (size_t row=0; row&lt;rows; ++row) { double min = array_min (matrix[row], cols); subtract (matrix[row], cols, min); } print_matrix (matrix, rows, cols); return 0; } Example output: {{0.1, 0.2, 0.3, 0.4, 0.5}, {1.0, 0.9, 0.8, 0.7, 0.6}, {1.4, 1.5, 1.3, 1.1, 1.2}, {1.8, 1.7, 1.6, 2.0, 1.9}} {{0.0, 0.1, 0.2, 0.3, 0.4}, {0.4, 0.3, 0.2, 0.1, 0.0}, {0.3, 0.4, 0.2, 0.0, 0.1}, {0.2, 0.1, 0.0, 0.4, 0.3}}


How do you find the range and domain of a graph function?

Assuming the standard x and y axes, the range is the maximum value of y minus minimum value of y; and the domain is the maximum value of x minus minimum value of x.