#include #include #include void main() { const int N = 100; int a[N], n; do { printf("\nEnter n (1-%d%s", N, "): "); scanf("%d", &n); } while (n <= 0 || n > N); const int k = 20; // граница диапазона [-20,20] int max = -21, imax = -1; printf("\n"); for (int i = 0; i < n; i++) { a[i] = rand()%(k * 2 +1) - k; //генерируем массив случайных чисел в диапазоне [-k..k] printf("a[%d%s%d%s", i, "]=", a[i], "\n"); //вывод элемента массива на экран if (a[i] < max) { max = a[i]; imax = i; } // поиск максимума } printf("\nmax = a[%d%s%d", imax, "]= " , max); getch(); }