XL Fortran for AIX V8.1.1

ユーザーズ・ガイド


例 1 - XL Fortran ソース・ファイル

      PROGRAM CALCULATE
!
! Program to calculate the sum of up to n values of x**3
! where negative values are ignored.
!
      READ(5,*) N
      SUM=0
      DO I=1,N
         READ(5,*) X
         IF (X.GE.0) THEN
            Y=X**3
            SUM=SUM+Y
         END IF
      END DO
      WRITE(6,*) 'This is the sum of the positive cubes:',SUM
      END

実行結果

このプログラムの実行結果を次に示します。


$ a.out
5
37
22
-4
19
6
 This is the sum of the positive cubes:  68376.00000


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]