Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Loops-While/Fortran/loops-while-1.f
Normal file
5
Task/Loops-While/Fortran/loops-while-1.f
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
INTEGER :: i = 1024
|
||||
DO WHILE (i > 0)
|
||||
WRITE(*,*) i
|
||||
i = i / 2
|
||||
END DO
|
||||
17
Task/Loops-While/Fortran/loops-while-2.f
Normal file
17
Task/Loops-While/Fortran/loops-while-2.f
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
PROGRAM LOOPWHILE
|
||||
INTEGER I
|
||||
|
||||
C FORTRAN 77 does not have a while loop, so we use GOTO statements
|
||||
C with conditions instead. This is one of two easy ways to do it.
|
||||
I = 1024
|
||||
10 CONTINUE
|
||||
C Check condition.
|
||||
IF (I .GT. 0) THEN
|
||||
C Handle I.
|
||||
WRITE (*,*) I
|
||||
I = I / 2
|
||||
C Jump back to before the IF block.
|
||||
GOTO 10
|
||||
ENDIF
|
||||
STOP
|
||||
END
|
||||
12
Task/Loops-While/Fortran/loops-while-3.f
Normal file
12
Task/Loops-While/Fortran/loops-while-3.f
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
PROGRAM LOOPWHILE
|
||||
INTEGER I
|
||||
C FORTRAN 66 does not have IF block.
|
||||
I = 1024
|
||||
10 CONTINUE
|
||||
IF (I .LE. 0) GOTO 20
|
||||
WRITE (*,*) I
|
||||
I = I / 2
|
||||
GOTO 10
|
||||
20 CONTINUE
|
||||
STOP
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue