Microsoft Office Tutorials and References

In Depth Information

**F.6 FORTRAN**

F.6 FORTRAN

FORTRAN is a contraction of
Formula Translation,
a name that comes from a technical report

entitled "The IBM Mathematical FORmula TRANslating System," written by John Backus and his

team at IBM in the mid-1950s. FORTRAN is primarily designed for scientific calculations and

has the distinction of being the first widely used high-level programming language. Backus made

some rather interesting claims about FORTRAN; for instance, it was not designed for its beauty (a

reasonable statement) but it would eliminate coding errors and the consequent debugging process!

Here is the FORTRAN version of our little averaging program. (Lines that begin with a C are

comments.)

C FORTRAN PROGRAM TO COMPUTE THE AVERAGE

C OF A SET OF AT MOST 100 NUMBERS

Real SUM, AVE, NEXTNUM

SUM = 0.0

C Ask for the number of numbers

WRITE(*,*) 'Enter the number of numbers: '

READ(*,*) NUM

C If Num is between 1 and 100 then proceed

IF NUM .GT. 0 .AND. NUM .LE. 100 then

C Loop to collect the numbers to average

DO 10 I = 1, NUM

C Ask for next number

WRITE(*,*) 'Enter next number: '

READ(*,*) NEXTNUM

C Add the number to the running sum

SUM = SUM + NEXTNUM

10 CONTINUE

C Compute the average

AVE = SUM/NUM

C Display the average

WRITE(*,*) 'The average is: '

WRITE(*,*) AVE

ENDIF

STOP

END

F.7 COBOL

COBOL is an acronym for
Common Business Oriented Language
and it was developed in the late

1950s by Grace Hopper for the purpose of writing business-related programs, which she felt

should be written in English. However, it seems rather that the language was developed with the

express purpose of avoiding all mathematical-like notation. The inevitable consequence is that

conciseness and readability is also avoided.

At any rate, I could only bring myself to code a COBOL sample program that adds two numbers.

* COBOL PROGRAM TO ADD TWO NUMBERS