include iostream using namespace std int min int array int dimension i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
using namespace std;
int min(int *array, int dimension) {
int min;
min = array[0];
for(int r = 1; r < dimension; r++)
{
if(min > array[r]) min = array[r];
}
return min;
}
int main() {
int n;
printf("Enter the dimension of the array: ");
cin >> n;
int array[n];
for (int i = 0; i < n; i++) {
printf("Enter the value of element %d of the array: ", i);
cin >> array[i];
}
printf("The minimum value of the array = %d", min(array, n));
return 0;
}