Program #2

 

Part A

Write a FORTRAN program which will read in an integer  and print out its base 2 representation.  Your program should be well documented.  It is not required that it contain any subprograms.  The base 10 integer read in should be echoed out with a label and the base 2 result should be printed out with a label.

 

Your program should be able to handle integers in the range 1 to 32767.

 

Here is what the output should look like:

 

The base 10 value of the input is:  32767

The base  2 value of the input is: 1111111111

 

Part B

Write a FORTRAN program which will read in a decimal number and print out its base 2 representation.  Your program should be well documented.  It is not required that it contain any subprograms.  The base 10 decimal read in should be echoed out with a label and the base 2 result should be printed out with a label.

 

Your program should carry the base 2 fraction out to 6 places if it doesn’t terminate in less than that.

 

Here is what the output should look like

 

The base 10 value of the input is: .5

The base 2 value of the input is :  .1

 

The base 10 value of the input is: .125

The base 2 value of the input is:  .001

 

The base 10 value of the input is:  .124

The base 2 value of the input is:  .000111

 

 

Submission instructions will be posted once Blackboard problems have been resolved.

Submission instruction have been place on Blackboard.

 

This program must be submitted by 11:59 pm on Wednesday, September 12h and the printouts will be due at the start of class on Thursday, September 13th.