program for a Fahrenheit and Celsius table

I need a program that will print a table for Fahrenheit and Celsius. It should look something like this:
 Fahrenheit       Celsius

The numbers in the Fahrenheit are aligned starting with the "i" in Fahrenheit. The numbers in the Celsius are aligned starting with the "i" in Celsius.

The program should convert Fahrenheit to Celsius using this formula:
Celsius = (Fahr - 32) * 5/9)
The numbers in the Fahrenheit column are incremented by two.
I believe this should be in the form of a While loop. Here's what I have so far:

var celsius: real;
fahr := 32;
    while fahr < 100 do
      begin {begin while loop}
       celsius := (fahr - 32) * 5/9);
         writeln (fahr, ' ' , celsius)
           fahr := fahr + 2
      end;{end while loop}
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I have assumed you'll be using only up to 2 decimal places.  Here's the code and i hope it helps.

uses crt;
var celcius:real;
      fahrenheit:integer;{no use in declaring fahr. as real since you're                                       counting ordinal values, anyway}
     writeln('fahrenheit celcius');
           writeln(fahrenheit:9,' ',celcius:6:2);
     until count>100;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Your code seems ok.  The only problem is ouputting.  Try this in your code.

writeln('Fahrenheit, '     ', Celsius'); {* five spaces between Fahrenheit and Celsius *}


lama72phl's code is probably correct but he does not state how he is writing the line 'Fahrenheit     Celsius'

If he did he probably has the right answer.
their is only one space between 'fahrenheit' and 'celcius' in the
line:  writeln('fahrenheit celcius');
their is only one space between 'fahrenheit' and 'celcius' in the line:

  writeln('fahrenheit celcius');

also one space in:

   writeln(fahrenheit:9,' ',celcius:6:2);
This is a nicer way to do a cycle incrementing control variable by two:

For count:=0 to 100 do begin...

At each turn, Count is incremented twice: once by the Inc() procedure and once again by the For instruction itself.

Yes; that's a clear example of what NOT to be done. But it's clear, brief, and nice (and the most important: it works :)

A good comment will fix the problem of obscureness.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.