Answer the question
In order to leave comments, you need to log in
How to solve this problem in Turbo Pascal?
Given Z,X and Y. Calculate R=max(x+y,z,y+z) if x>y. Otherwise R=x+y+z.
Here's what I already have:
var
z,x,y,r:real;
function max(x, y, z:real):real;
begin
writeln('Vvedite X');
readln(x);
writeln('Vvedite Y');
readln(y);
writeln('Vvedite Z');
readln(z);
if (x>y)
then
R:=max(max(x+y,z),y+z);
else
R:=x+y+z;
writeln('R=',R);
end.
Answer the question
In order to leave comments, you need to log in
Here is the complete answer. Everything seems to be correct)
var
z,x,y,r:real;
function max(x,y : real) : real;
begin
if (x > y) then max := x
else max := y;
end;
begin
writeln('Vvedite X');
readln(x);
writeln('Vvedite Y');
readln(y);
writeln('Vvedite Z');
readln(z);
if (x>y)
then
R:=max(max(x+y,z),y+z) else R:=x+y+z;
writeln('R=',R);
end.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question