Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,037 questions

40,788 answers

573 users

How to use arithmetic expressions in COBOL

1 Answer

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOL-PRO.
 
DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 A-NUM1 PIC 9(3) VALUE 2.
   01 A-NUM2 PIC 9(3) VALUE 30.
   01 A-NUM3 PIC 9(3) VALUE 8.
   01 A-NUM4 PIC 9(3) VALUE 12.
   01 A-NUM5 PIC 9(3) VALUE 4.
   01 A-NUM6 PIC 9(3).
   
PROCEDURE DIVISION.
   COMPUTE A-NUM6 = (A-NUM1 * A-NUM2) - (A-NUM4 / A-NUM5) + A-NUM3.

   DISPLAY "A-NUM1 : " A-NUM1
   DISPLAY "A-NUM2 : " A-NUM2
   DISPLAY "A-NUM3 : " A-NUM3
   DISPLAY "A-NUM4 : " A-NUM4
   DISPLAY "A-NUM5 : " A-NUM5
   DISPLAY "A-NUM6 : " A-NUM6
   
STOP RUN.
 
 
 
# run:
# 
# A-NUM1 : 002
# A-NUM2 : 030
# A-NUM3 : 008
# A-NUM4 : 012
# A-NUM5 : 004
# A-NUM6 : 065

 





answered Sep 18, 2020 by avibootz

Related questions

1 answer 100 views
100 views asked Sep 17, 2020 by avibootz
1 answer 122 views
122 views asked Sep 17, 2020 by avibootz
1 answer 115 views
115 views asked Sep 17, 2020 by avibootz
1 answer 107 views
107 views asked Sep 17, 2020 by avibootz
...