PROGRAM NINE
For the first twenty values (1 - 20) of fahrenheit, print out the
equivalent degree in celsius (Use a tabular format, with
appropiate headings). [C = ( 5 / 9 ) * (fahrenheit - 32)]
Use the statement writeln('<14>'); to clear the screen.
PROGRAM NINE Table of 1 to 20 Celcius
program PROG9 (output);
var fahrenheit : real;
celsius : integer;
begin
writeln('<14>'); {clear screen on DG machine}
writeln('Degrees Fahrenheit Degrees Celsius');
for fahrenheit := 1 to 20 do
begin
celsius := ( 9 / 5 ) * (fahrenheit - 32);
writeln( fahrenheit:16:2, ' ', celsius:8 )
end
end.
Turbo Pascal for DOS Version
PROGRAM NINE Table of 1 to 20 Celsius
program PROG9 (output);
uses DOS;
var fahrenheit : real;
celsius : integer;
begin
clrscr; {clear screen}
writeln('Degrees Fahrenheit Degrees Celsius');
for fahrenheit := 1 to 20 do
begin
celsius := ( 9 / 5 ) * (fahrenheit - 32);
writeln( fahrenheit:16:2, ' ', celsius:8 )
end
end.