Language IBM 1130 BASIC FORTRAN-IV
(1130 Fortran was a subset of Fortran IV.)
Date: | 09/09/06 |
Author: | Steve Ketcham |
URL: | n/a |
Comments: | 0 |
Info: | http://ibm1130.org/ |
Score: | (3.01 in 100 votes) |
// JOB // FOR *ONE WORD INTEGERS *IOCS(1132 PRINTER) *LIST ALL C PROGRAM TO WRITE THE LYRICS OF '99 BOTTLES OF BEER' FOR THE C IBM 1130. C C WRITTEN BY STEVE KETCHAM 06 SEP 2006. C C IBM 1130 FORTRAN WAS A SUBSET OF FORTAN-IV. THE MOST IMPORTANT LIMITS C WERE THAT ONLY ARITHMETIC IF STATEMENTS WERE ALLOWED, AND VARIABLE C NAMES COULD HAVE NO MORE THAN 5 CHARACTERS. C C IN THE SPIRIT OF 1130 PROGRAMMERS, NO VARIABLES ARE DECLARED. NAMES C STARTING WITH THE LETTERS I THROUGH N ARE INTEGER VARIABLES. C C STARTING NUMBER OF BOTTLES. C IBTL = 99 C C START A NEW PAGE OF OUTPUT C WRITE(3, 10) 10 FORMAT(1H1) C C LOOP TO DISPLAY THE LYRICS. C DO 100 I=1,IBTL C C JBTL IS THE NUMBER OF BOTTLES BEFORE TAKING ONE DOWN. C JBTL = IBTL-I+1 C C KBTL IS THE NUMBER OF BOTTLES AFTER TAKING ONE DOWN. C KBTL = JBTL - 1 C SEE IF WE HAVE TWO PLURALS, ONE PLURAL, OR WE'RE AT THE END. C NOTE THAT THIS IS THE RARE CASE WHERE A THREE-WAY BRANCS IS C ACTUALLY USEFUL. C IF (KBTL-1) 130,120,110 C C TWO 'BOTTLES' C 110 WRITE(3,12) JBTL, JBTL, KBTL 12 FORMAT(1H0, I2,1X,'BOTTLES OF BEER ON THE WALL, ',I2,1X,'BOTTLES O 1F BEER.'/' TAKE ONE DOWN AND PASS IT AROUND, ',I2,1X,'BOTTLES OF B 2EER ON THE WALL.') GO TO 100 C C ONE 'BOTTLES' ONE 'BOTTLE' C 120 WRITE(3,14) JBTL, JBTL, KBTL 14 FORMAT(1H0, I2,1X,'BOTTLES OF BEER ON THE WALL, ',I2,1X,'BOTTLES O 1F BEER.'/' TAKE ONE DOWN AND PASS IT AROUND, ',I2,1X,'BOTTLE OF BE 2ER ON THE WALL.') GO TO 100 C C LAST TIME C 130 WRITE(3,16) JBTL, JBTL 16 FORMAT(1H0, I2,1X,'BOTTLE OF BEER ON THE WALL, ',I2,1X,'BOTTLE OF 1BEER.'/' TAKE ONE DOWN AND PASS IT AROUND, NO MORE BOTTLES OF BEER 2 ON THE WALL.') 100 CONTINUE C C WRITE THE LAST VERSE C WRITE(3,18) IBTL 18 FORMAT(1H0, 'NO MORE BOTTLES OF BEER ON THE WALL, NO MORE BOTTLES 1OF BEER.'/' GO TO THE STORE AND BUY SOME MORE, ',I2,' BOTTLES OF B 2EER ON THE WALL.') CALL EXIT END // XEQ L
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments