Algorithm Analysis
Using a loop, we find the smallest element of the array . We output its doubled value.
Algorithm Implementation
We read the input data. We look for 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; }
We output the answer – the doubled minimum element.
printf("%.2lf\n", 2 * min);