/*COBOL PROGRAM TO FIND OUT STUDENT GRADES. */
IDENTIFICATION DIVISION.
PROGRAM-ID STUDENTGRADE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 M1 PIC 9(2).
77 M2 PIC 9(2).
77 M3 PIC 9(2).
77 TOTAL PIC 9(4).
88 FIRST1 VALUE 180 THRU 300.
88 SECOND VALUE 150 THRU 179.
88 THIRD VALUE 120 THRU 149.
88 FAIL VALUE 0 THRU 119.
PROCEDURE DIVISION.
PARA.
DISPLAY 'ENTER STUDENTMARKS'.
ACCEPT M1.
ACCEPT M2.
ACCEPT M3.
COMPUTE TOTAL = M1 + M2 + M3.
DISPLAY TOTAL.
IF FIRST1
DISPLAY 'A GRADE'
ELSE
IF SECOND
DISPLAY 'B GRADE'
ELSE
IF THIRD
DISPLAY 'C GRADE'
ELSE
DISPLAY 'FAIL'
STOP RUN.
OUTPUT:
ENTER STUDENT MARKS
45
55
65
0165
B GRADE
No comments:
Post a Comment