Ok, Thanks. Next question, why do I get this error:
project1.lpr(41,7) Error: Identifier not found "Format"
With this code:
var
Height: Double;
Weight: Double;
IdealWeight: Double;
begin
Write('What is your height in meters (e.g. 1.8 meter) : ');
Readln(Height);
Write('What is your weight in kilos : ');
Readln(Weight);
if Height >= 1.4 then
IdealWeight:= (Height - 1) * 100
else
IdealWeight:= Height * 20;if (Height < 0.4) or (Height > 2.5) or (Weight < 3) or
(Weight > 200) then
begin
Writeln('Invalid values');
Writeln('Please enter proper values');
end
else
if IdealWeight = Weight then
Writeln('Your weight is suitable')
else
if IdealWeight > Weight then
Writeln('You are under weight, you need more ',
Format('%.2f', [IdealWeight - Weight]), ' Kilos')
else
Writeln('You are over weight, you need to lose ',
Format('%.2f', [Weight - IdealWeight]), ' Kilos');
Write('Press enter key to close');
Readln;
end.
Thanks