<!-- hamlet
<!-- copytar
examples/                                                                                              755    1107     770            0  5551031457   5712                                                                                                                                                                                                                                                                                                                                                                      examples/loop2.f                                                                                       644    1107     770         1313  5506142034   7171                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C A recoding of the previous NOLOOP example


      PROGRAM NOLOOP
      IMPLICIT NONE
      REAL X, SUM

      SUM = 0

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
G  cs677  	  @ d>  cs506 L  P o+  cs507 d  ` 	d3  cs508   p z  cs509 n1   
X  cs511 rt   n  cs531  	   D  cs537    C  cs539     D  cs541      8  cs542      cs546       ɥ  cs547 n2    d%  cs100 rt   !e  cs561      *  cs56examples/loop1.f                                                                                       644    1107     770         1116  5506142034   7171                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Illustrates the need for DO loops


      PROGRAM NOLOOP
      IMPLICIT NONE
      REAL A, B, C, D, E, F

      PRINT *, 'Please enter a number: '
      READ *, A

      PRINT *, 'Please enter a number: '
      READ *, B

      PRINT *, 'Please enter a number: '
      READ *, C

      PRINT *, 'Please enter a number: '
      READ *, D

      PRINT *, 'Please enter a number: '
      READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

      PRINT *, 'The sum of the numbers is ', A+B+C+D+E+F

      STOP
      END
nter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
G  cs677  	  @ d>  cs506 L  P o+  cs507 d  ` 	d3  cs508   p z  cs509 n1   
X  cs511 rt   n  cs531  	   D  cs537    C  cs539     D  cs541      8  cs542      cs546       ɥ  cs547 n2    d%  cs100 rt   !e  cs561      *  cs56examples/loop3.f                                                                                       644    1107     770          572  5506142034   7160                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C A recoding of the previous NOLOOP example


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER I
      REAL X, SUM

      SUM = 0

      DO I = 1, 6
         PRINT *, 'Please enter a number: '
         READ *, X
         SUM = SUM + X
      ENDDO

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
      READ *, D

      PRINT *, 'Please enter a number: '
      READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop4.f                                                                                       644    1107     770          665  5506142035   7165                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Looping a variable number of times


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER I, N
      REAL X, SUM

      PRINT *, 'How many numbers should I read?'
      READ *, N

      SUM = 0

      DO I = 1, N
        PRINT *, 'Please enter a number: '
        READ *, X
        SUM = SUM + X
      ENDDO

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
     READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop5.f                                                                                       644    1107     770          565  5506142035   7165                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Computes the sum of the squares of the numbers from 1 to 5


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER SUM

      SUM = 0

      SUM = SUM + 1*1

      SUM = SUM + 2*2

      SUM = SUM + 3*3

      SUM = SUM + 4*4

      SUM = SUM + 5*5

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
RINT *, 'The sum of the numbers is ', SUM

      STOP
      END
     READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop6.f                                                                                       644    1107     770          675  5506142035   7170                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Another approach to summing squares


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER SUM, I

      SUM = 0
      I = 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
D *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop7.f                                                                                       644    1107     770          447  5506142035   7166                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C A DO loop approach to summing squares


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER SUM, I

      SUM = 0

      DO I = 1, 5
        SUM = SUM + I*I
      ENDDO

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
+ 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
D *, E

      PRINT *, 'Please enter a number: '
      READ *, F

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 nter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'Please enter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
G  cs677  	  @ d>  cs506 L  P o+  cs507 d  ` 	d3  cs508   p z  cs509 n1   
X  cs511 rt   n  cs531  	   D  cs537    C  cs539     D  cs541      8  cs542      cs546       ɥ  cs547 n2    d%  cs100 rt   !e  cs561      *  cs56examples/loop1.f                                                                                       644    1107     770         1116  5506142034   7171                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Illustrates the need for DO loops


      PROGRAM NOLOOP
      IMPLICIT NONE
      REAL A, B, C, D, E, F

      PRINT *, 'Please enter a number: '
      READ *, A

      PRINT *, 'Please enter a number: '
      READ *, B

      PRINT *, 'Please enter a number: '
      READ *, C

      PRINT *, 'Please enter a number: '
      READ *, D

      PRINT *, 'Please enter a number: '
      READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

      PRINT *, 'The sum of the numbers is ', A+B+C+D+E+F

      STOP
      END
nter a number: '
      READ *, X
      SUM = SUM + X

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
G  cs677  	  @ d>  cs506 L  P o+  cs507 d  ` 	d3  cs508   p z  cs509 n1   
X  cs511 rt   n  cs531  	   D  cs537    C  cs539     D  cs541      8  cs542      cs546       ɥ  cs547 n2    d%  cs100 rt   !e  cs561      *  cs56examples/loop3.f                                                                                       644    1107     770          572  5506142034   7160                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C A recoding of the previous NOLOOP example


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER I
      REAL X, SUM

      SUM = 0

      DO I = 1, 6
         PRINT *, 'Please enter a number: '
         READ *, X
         SUM = SUM + X
      ENDDO

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
      READ *, D

      PRINT *, 'Please enter a number: '
      READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop4.f                                                                                       644    1107     770          665  5506142035   7165                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Looping a variable number of times


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER I, N
      REAL X, SUM

      PRINT *, 'How many numbers should I read?'
      READ *, N

      SUM = 0

      DO I = 1, N
        PRINT *, 'Please enter a number: '
        READ *, X
        SUM = SUM + X
      ENDDO

      PRINT *, 'The sum of the numbers is ', SUM

      STOP
      END
     READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop5.f                                                                                       644    1107     770          565  5506142035   7165                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Computes the sum of the squares of the numbers from 1 to 5


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER SUM

      SUM = 0

      SUM = SUM + 1*1

      SUM = SUM + 2*2

      SUM = SUM + 3*3

      SUM = SUM + 4*4

      SUM = SUM + 5*5

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
RINT *, 'The sum of the numbers is ', SUM

      STOP
      END
     READ *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop6.f                                                                                       644    1107     770          675  5506142035   7170                                                                                                                                                                                                                                                                                                                                                                      C Created: Joe Zachary, January 26, 1993
C Modified: 

C Another approach to summing squares


      PROGRAM LOOP
      IMPLICIT NONE
      INTEGER SUM, I

      SUM = 0
      I = 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      SUM = SUM + I*I
      I = I + 1

      PRINT *, 'The sum of squares is ', SUM

      STOP
      END
D *, E

      PRINT *, 'Please enter a number: '
      READ *, F

 examples/loop7.f                                                                                       644    1107     770          447  5506142035   7166                                                                                                                                                                                                                                                                                                                                                                      