готово
Объяснение:
1)
program minimum;
var
i, n, k: integer;
min: real;
A: array of real;
begin
Write('Введите размер массива: ');
ReadLn(n);
SetLength(A, n);
for i := 0 to n - 1 do
Write('Введите A[',i,']=');
ReadLn(A[i]);
end;
min := A[0];
for i := 1 to n - 1 do
if A[i] < min then
min := A[i];
k := i;
WriteLn('Минимальный элемент - A[',k,'] = ', min);
end.
2)
program summa;
i, t, sum: integer;
A: array of integer;
ReadLn(t);
SetLength(A, t);
for i := 0 to t - 1 do
A[i] := round(random(120) - 60);
WriteLn('A[', i, '] = ', A[i]);
if A[i] > 20 then sum := sum + a[i];
WriteLn('Сумма чисел, больших 20 = ', sum);
3)
program massiv;
i, k: integer;
A: array[0..13] of integer;
for i := 0 to 13 do
A[i] := round(random(27) + 3);
if A[i] > 13 then k := k + 1;
WriteLn('Количество чисел, больших 13 равно ', k);
#include <Time.h>
using namespace std;
int main()
{
int n, i, k;
cout << "Kolichestvo chisel = ";
cin >> n;
srand(time(0));
int *a = new int[n];
for (int i = 0; i < n; i++)
{
a[i] = rand() % 56 - 10;
cout << a[i] << " ";
}
int min = a[0];
for (i = 0; i<n; i++)
if (min>a[i]) {
min = a[i];
k = i;
}
cout << endl << endl;
cout << "Min = " << min << endl << "i = " << k << endl;
system("pause");
return 0;
}
готово
Объяснение:
1)
program minimum;
var
i, n, k: integer;
min: real;
A: array of real;
begin
Write('Введите размер массива: ');
ReadLn(n);
SetLength(A, n);
for i := 0 to n - 1 do
begin
Write('Введите A[',i,']=');
ReadLn(A[i]);
end;
min := A[0];
for i := 1 to n - 1 do
if A[i] < min then
begin
min := A[i];
k := i;
end;
WriteLn('Минимальный элемент - A[',k,'] = ', min);
end.
2)
program summa;
var
i, t, sum: integer;
A: array of integer;
begin
Write('Введите размер массива: ');
ReadLn(t);
SetLength(A, t);
for i := 0 to t - 1 do
begin
A[i] := round(random(120) - 60);
WriteLn('A[', i, '] = ', A[i]);
if A[i] > 20 then sum := sum + a[i];
end;
WriteLn('Сумма чисел, больших 20 = ', sum);
end.
3)
program massiv;
var
i, k: integer;
A: array[0..13] of integer;
begin
for i := 0 to 13 do
begin
A[i] := round(random(27) + 3);
WriteLn('A[', i, '] = ', A[i]);
if A[i] > 13 then k := k + 1;
end;
WriteLn('Количество чисел, больших 13 равно ', k);
end.