Даны действительные a, b, c, d. используя функции поиска максимума двух чисел max и минимума двух чисел min, получить: max(a, b)+min(a, b) +min(c,d) ––––—–– . max(a, b, c, d) + min(a,b,c)
Program Task; Var a, b, c, d: Integer; Function Max(a, b: Integer): Integer; Begin If a > b Then Result := a Else Result := b; End; Function Min(a, b: Integer): Integer; Begin If a < b Then Result := a Else Result := b; End; Begin Write('a = '); ReadLn(a); Write('b = '); ReadLn(b); Write('c = '); ReadLn(c); Write('d = '); ReadLn(d); WriteLn('max(a, b) + min(a, b) + min(c,d) = ', Max(a, b) + Min(a, b) + Min(c,d)); WriteLn('max(a, b, c, d) + min(a, b, c) = ', Max(Max(a, b), Max(c, d)) + Min(Max(a, b), c)); ReadLn; End.
Var a, b, c, d: Integer;
Function Max(a, b: Integer): Integer;
Begin
If a > b Then
Result := a
Else
Result := b;
End;
Function Min(a, b: Integer): Integer;
Begin
If a < b Then
Result := a
Else
Result := b;
End;
Begin
Write('a = ');
ReadLn(a);
Write('b = ');
ReadLn(b);
Write('c = ');
ReadLn(c);
Write('d = ');
ReadLn(d);
WriteLn('max(a, b) + min(a, b) + min(c,d) = ', Max(a, b) + Min(a, b) + Min(c,d));
WriteLn('max(a, b, c, d) + min(a, b, c) = ', Max(Max(a, b), Max(c, d)) + Min(Max(a, b), c));
ReadLn;
End.