Computers in Engineering WWW Site - Example 4.4

Example 4.4


FORTRAN Version

!
      PROGRAM P44
!
!
      IMPLICIT NONE
      INTEGER :: N
      REAL :: X,Y
      PRINT *, 'This is Program >> P44  - F conversion for REALs'
!
!     Print 1 integer and 2 real numbers
      N=375
      X=37.9
      Y=-41.25
      PRINT 101, N, X, Y
101   FORMAT(I10,2F10.2)
!     Be consistent
!     The order and type must match
      STOP
      END PROGRAM P44
OUTPUT:

              +--------------------------------------------------+
              |     32-bit Power for Lahey Computer Systems      |
              |   Phar Lap's 386|DOS-Extender(tm) Version 7.0    |
              |  Copyright (C) 1986-94 Phar Lap Software, Inc.   |
              |           Available Memory = 14880 Kb            |
              +--------------------------------------------------+


This is Program >> P44  - F conversion for REALs
      375     37.90    -41.25

Pascal Version

PROGRAM p44 (input, output);
VAR
  n : INTEGER;
  x, y : REAL;
BEGIN
  n := 375;
  x := 37.9;
  y := -41.25;
  writeln (n : 10, x : 10:2, y : 10:2)
END.

Last modified: 21/07/97