Даны натуральные числа k,l, целые числа a[1..k], b[1..l],с[1..10]. Получить │ min(b[1..l])+min(c[1..10]) │ l=< при abs(max(a[1],...,a[k]))>10, │ │ 1+(sin(max(c[1],...,с[10])))^2 в противном случае

code: #pascal
program dk;
type mass=array [1..100] of integer;
 
var k,l,i:integer;
    a,b,c:mass;
    ko1,ko2:integer; ko3:real;
 
function max(x:mass; n:integer):integer;
var i,m:integer;
begin
m:=x[1];
for i:=2 to n do
if x[i]>m then m:=x[i];
max:=m; end;
 
function min(x:mass; n:integer):integer;
var i,m:integer;
begin
m:=x[1];
for i:=2 to n do
if x[i]<m then m:=x[i];
min:=m; end;
 
begin
write('Vvedite "k"= '); readln(k);
write('Vvedite "l"= '); readln(l);
writeln;
for i:=1 to k do
begin write('a[',i,']= '); readln(a[i]); end;
writeln;
for i:=1 to l do
begin write('b[',i,']= '); readln(b[i]); end;
writeln;
for i:=1 to 10 do
begin write('c[',i,']= '); readln(c[i]); end;
 
write('A[1..k]=  ');  for i:=1 to k do write(a[i],'  ');  writeln;
write('B[1..l]=  ');  for i:=1 to l do write(b[i],'  ');  writeln;
write('C[1..10]= '); for i:=1 to 10 do write(c[i],'  ');  writeln;
 writeln;
 
 ko1:=min(b,l)+min(c,10);
 ko2:=abs(max(a,k));
 ko3:=1+sqr(sin(max(c,10)));
 
writeln('min(b,l)+min(c,10)= ',ko1);
writeln('abs(max(a,k))= ',ko2);
writeln('1+sqr(sin(max(c,10)))= ',ko3:0:2);
 
readln;
end.      
Поделиться:

Похожие статьи: