Skip to Content
Custom Search

COBOL EVALUATE ARITHMETIC EXPRESSION

 

EVALUATE ARITHMETIC EXPRESSION
 
The following COBOL program depicts the use of 
EVALUATE ARITH EXPRESSION
 
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM025.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 MARKS-OBTAINED  PIC 9(4)  VALUE ZEROS.
       01 MARKS-TOTAL     PIC 9(4)  VALUE ZEROS.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
             MOVE 900  TO MARKS-OBTAINED.
             MOVE 1000 TO MARKS-TOTAL.
             EVALUATE ((MARKS-OBTAINED/MARKS-TOTAL)*100)
                 WHEN 100
                  DISPLAY 'STUDENT HAS 100% MARKS'
                 WHEN NOT 100
                  DISPLAY 'STUDENT DOES NOT HAVE 100% MARKS'
             END-EVALUATE
             STOP RUN.
 
 
The output of the program is 
 
STUDENT DOES NOT HAVE 100% MARKS                                                                                         

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 39 guests online.
Dr. Radut | page