Next: Statement Ordering and Program
Up: Introduction to FORTRAN
Previous: BLOCK DATA Statements
Octal and Hexadecimal
Normally integers are displayed in decimal. Sometimes it is more useful to
use octal (base 8) or hexadecimal (base 16). The way in which such constants
are written is not the same on all computers, in fact most won't allow octal
(but the VMS will). For example the hexadecimal number 1A (i.e. the decimal
number 26) is written:-
Z1A (IBM)
'1A'X (VMS)
There is no octal constant on the IBM; on the VMS the octal number 11 (i.e. the
decimal number 9) is written:-
'11'O
During I/O the format descriptor Om.n is used for octal and Zm.n for
hexadecimal - see section 9.2.
Exercise 18
Write a program to type out the integers -1000, -100, -1, 0, 1, 100 and 1000 in
a table in decimal, octal and hexadecimal.
* * *
n west (APC)
2000-03-08