Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Pascal Tasks IV

For each of the following tasks:

 Write a basic algorithm (plan your program)


Type the code into the Pascal editor
Compile the code
Run the code
 Test the code – check that the answers are correct

Write a program to convert decimal to binary. Your program should:


 Prompt the user to enter a binary number.
 Convert the binary number to a decimal number.
 Display the decimal number.

Write a program to convert decimal to octal. Your program should:


 Prompt the user to enter an octal number.
 Convert the octal number to a decimal number.
 Display the decimal number.

Write a program to convert decimal to hexadecimal. Your program should:


 Prompt the user to enter a hexadecimal number.
 Convert the hexadecimal number to a decimal number.
 Display the decimal number.

Convert the above programs into subprograms and allow the user to choose which
type of conversion he/she wants the program to perform.

Advanced:
Expand your program to go both ways.

You might also like