Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM THAT DESCRIBES THE USE OF IF

Posted By: Varick Fischer     Category: Cobol     Views: 1331

WRITE A PROGRAM THAT DESCRIBES THE USE OF IF.

Code for PROGRAM THAT DESCRIBES THE USE OF IF in Cobol

       IDENTIFICATION DIVISION.
       PROGRAM-ID. con-if.

       DATA DIVISION.
       01 n1 PIC 99.
       01 x1 PIC XX.
       01 n3 PIC 99,99.
       01 n2 PIC 99.99.
       01 n4 PIC 99v99.

       PROCEDURE DIVISION.
        if-con1.
           DISPLAY "ENTER N1".
           ACCEPT n1.
           DISPLAY "ENTER N2".
           ACCEPT n2.
      *HERE EDIT CHAR IS USED SO COMP IS NOT DONE
           if n1=n2
            display "n1 equal to n2".
           
           DISPLAY "ENTER N4".
           ACCEPT n4.
           if n1=n4
            display "n1 equal to n4".
           
           DISPLAY "ENTER x1".
           ACCEPT x1.
           if n1=x1
            display "n1 equal to x1".

           DISPLAY "ENTER n3".
           ACCEPT n3.
           if n1=n3
            display "n1 equal to n3".
           
           if n1=12 
            NEXT SENTENCE.
           
           if n1=12 
            move n1 to n2
           else
            NEXT SENTENCE.
           display n2.
           
           if n1=12 
             NEXT SENTENCE
           else
            move n1 to n2.
           display n2.

           STOP RUN.

*****************************************************************
ENTER N1
12
ENTER N2
12
n1 equal to n2
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM THAT DESCRIBES THE USE OF IF Or get search suggestion and latest updates.

Varick Fischer
Varick Fischer author of PROGRAM THAT DESCRIBES THE USE OF IF is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!