Wednesday, January 25, 2012

PROGRAM ON CONDITION NAME TO CHECK THE CHARACTERS


       IDENTIFICATION DIVISION.
       PROGRAM-ID "CONDITION-NAME".
       AUTHOR "ABC".
       DATE-WRITTEN 18/01/2012.
       DATE-COMPILED 18/01/2012.
     
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER P4.
       OBJECT-COMPUTER P4.
     

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77 N PIC X.
       88 VOWEL VALUE IS "A","E","I","O","U".
       88 CONSONENT VALUE IS "B" THRU "D","F" THRU "H","J" THRU "N","P" THRU "T","V" THRU "Z".
       88 DIGIT VALUE IS "0" THRU "9".
       88 V-CHAR VALUE IS "0" THRU "9","A" THRU "Z".

       PROCEDURE DIVISION.
       DISPLAY "ENTER THE CHARACTER TO BE CHECKED".
       ACCEPT N.
       PARA1.
       IF VOWEL
       DISPLAY "CHARACTER " N " IS A VOWEL"
       ELSE IF CONSONENT
       DISPLAY "CHARACTER " N " IS A CONSONENT"
       ELSE IF DIGIT
       DISPLAY "CHARACTER " N " IS A DIGIT"
       ELSE
       DISPLAY "CHARACTER " N " IS NOT VALID".
       END-PARA.
       STOP RUN.

No comments:

Post a Comment