P41.F90

Loop w/ an increment of 2


!
! =====> Program - P41.F90
!
!     Loop with an increment of 2
!
      PRINT *, 'This is Program >> P41  - DO loop'
!
!     M takes odd values from 1 to 99
      LS=0
      LT=0
L1:   DO  M=1,100,2
         LS=LS+1
         LT=LT+M
         PRINT * ,LS,M,LT
      END DO L1
200   PRINT * ,LS,M,LT
      STOP
      END

OUTPUT:
Program entered
 This is Program >> P41  - DO loop
 1 1 1
 2 3 4
 3 5 9
 4 7 16
 5 9 25
 6 11 36
 7 13 49
 8 15 64
 9 17 81
 10 19 100
 11 21 121
 12 23 144
 13 25 169
 14 27 196
 15 29 225
 16 31 256
 17 33 289
 18 35 324
 19 37 361
 20 39 400
 21 41 441
 22 43 484
 23 45 529
 24 47 576
 25 49 625
 26 51 676
 27 53 729
 28 55 784
 29 57 841
 30 59 900
 31 61 961
 32 63 1024
 33 65 1089
 34 67 1156
 35 69 1225
 36 71 1296
 37 73 1369
 38 75 1444
 39 77 1521
 40 79 1600
 41 81 1681
 42 83 1764
 43 85 1849
 44 87 1936
 45 89 2025
 46 91 2116
 47 93 2209
 48 95 2304
 49 97 2401
 50 99 2500
 50 101 2500
Fortran-90 STOP

Come back to the previous page

Page builder: Charles Boivin

Last modified: 11/07/95