Advertisement
Guest User

Untitled

a guest
Feb 4th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 0.74 KB | None | 0 0
  1.       $ SET SOURCEFORMAT"FREE"
  2. IDENTIFICATION DIVISION.
  3. PROGRAM-ID.  Multiplier.
  4. AUTHOR.  Michael Coughlan.
  5. * Example program using ACCEPT, DISPLAY and MULTIPLY to
  6. * get two single digit numbers from the user and multiply them together
  7.  
  8. DATA DIVISION.
  9.  
  10. WORKING-STORAGE SECTION.
  11. 01  Num1                                PIC 9  VALUE ZEROS.
  12. 01  Num2                                PIC 9  VALUE ZEROS.
  13. 01  Result                              PIC 99 VALUE ZEROS.
  14.  
  15. PROCEDURE DIVISION.
  16.     DISPLAY "Enter first number  (1 digit) : " WITH NO ADVANCING.
  17.     ACCEPT Num1.
  18.     DISPLAY "Enter second number (1 digit) : " WITH NO ADVANCING.
  19.     ACCEPT Num2.
  20.     MULTIPLY Num1 BY Num2 GIVING Result.
  21.     DISPLAY "Result is = ", Result.
  22.     STOP RUN.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement