int main() { int a[12],max,min,k=1,l=1; for (i=1;i<=12;i++) cin >> a[i]; max = a[1]; min = max; for (i=2;i<=12;i++) { if (a[i] <= min) { min = a[i]; k = i; } if (a[i] >= max) { max = a[i]; l = i; } } cout << "sum = " << min +max << endl; cout << "max =" << max << " № "<< l << endl; cout << "min =" << min << " № "<< k << endl; }
#include<iostream>
using namespace std;
int main()
{
int a[12],max,min,k=1,l=1;
for (i=1;i<=12;i++)
cin >> a[i];
max = a[1];
min = max;
for (i=2;i<=12;i++)
{
if (a[i] <= min) { min = a[i]; k = i; }
if (a[i] >= max) { max = a[i]; l = i; }
}
cout << "sum = " << min +max << endl;
cout << "max =" << max << " № "<< l << endl;
cout << "min =" << min << " № "<< k << endl;
}
const n= 12;
var a:array[1..n]of integer;
i,min,max,nmin,nmax:integer;
begin
min:=99999;
max:=0;
for i:=1 to n do begin
readln(a[i]);
if a[i]>max then begin max:=a[i];
nmax:=i;
end;
if a[i]<min then begin min:=a[i];
nmin:=i;
end;
end;
writeln ('Сумма max+min ',max+min);
writeln ('Максимальное ',max,' индекс', nmax);
writeln ('Ммнимальное ',min,' индекс', nmin);
end.