include iostream using namespace std double min double array int dimen

 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
using namespace std;
double min(double array[], int dimension) {
double min = array[0];
for (int i = 0; i < dimension; ++i) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
int min(int array[], int dimension) {
int min = array[0];
for (int i = 0; i < dimension; ++i) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
int main() {
int n;
printf("Enter the dimension of the arrays: ");
cin >> n;
int array[n];
double arr[n];
printf("Enter int array: ");
for (int i = 0; i < n; i++) {
printf("Enter the value of element %d of the int array: ", i);
cin >> array[i];
}
printf("Enter double array: ");
for (int i = 0; i < n; i++) {
printf("Enter the value of element %d of the double array: ", i);
cin >> arr[i];
}
printf("The minimum value of the int array = %d \n", min(array, n));
printf("The minimum value of the double array = %f", min(arr, n));
return 0;
}