Using a loop, find the minimum element of the array . Then print its twice value.
Algorithm implementation
Read the input data. Compute the minimum element of the array.
scanf("%d", &n);
min = 100;
for (i = 0; i < n; i++)
{
scanf("%lf", &a);
if (a < min) min = a;
}Print the answer — the twice value of the minimum element.
printf("%.2lf\n", 2 * min);Python implementation
Read the input data.
n = int(input())
lst = list(map(float, input().split()))Compute the minimum element of the list .
min_el = min(lst)Print the answer — the twice value of the minimum element.
print(2 * min_el)