Program for if condition, COBOL Programming

PROGRAM FOR IF :

 We have to write a program to check whether the given number is ODD or EVEN.

Identification division.

Program- id. Ifst.

Environment division.

Data division.

Working-storage section.

01 n pic 9(3) value 0.

01 q pic 9(3) value 0.

01 r pic 9(3) value 0.

Procedure division.

Para-1.

  Display(1 1) erase.

  Display( 3 5) " Enter a Number :".

  Accept n.

  Divide n by 2 giving q remainder r.

            If  (r = 0) 

                 Display(10 5) " EVEN NUMBER"

       Go to end-para.

            Display(10 5) " ODD NUMBER"

End-para.

               Stop run.

Posted Date: 10/17/2012 7:42:34 AM | Location : United States







Related Discussions:- Program for if condition, Assignment Help, Ask Question on Program for if condition, Get Answer, Expert's Help, Program for if condition Discussions

Write discussion on Program for if condition
Your posts are moderated
Related Questions
/ (Slash Insertion): The edit character slash (/) also termed as virgule or stroke, may appear anyplace in the picture. When used, it will be inserted. More than one slash can

Selection of file Organization: While designing a file, the programmer should select an appropriate association for a file. The order in which the choice is to be made is as s

Name the divisions in a COBOL program are given below DENTIFICATION DIVISION DATA DIVISION ENVIRONMENT DIVISION PROCEDURE DIVISION.

RULES OF REDEFINES CLAUSE The rules shown below govern the use of the REDEFINES clause: (i) The level-number of data-name-1 and data-name-2 should be identical. (ii) Exce

READ STATEMENTS: The common format for the read statements is as shown bellow. Format 1: READ file-name RECORD [ INTO   identifier ] [  ;  AT   END     imperative-s

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla

WRITE STATEMENT: The records are written to be logical place as determined from the value of the record key. The INVALID KEY condition occurs in the cases shown below: (i)

PROGRAM TO FIND INTEREST ON BANK DEPOSITS: We have to write a program to find interest on deposits. The criteria is given below : identification division. program-

MULTIPLY VERB:   The Multiply Verb causes one or more multiplicands to be multiplied by the multiplier and to store the products. The form of the MULTIPLY verb is as shown be

MOVE CORRESPONDING: It is frequently required to move some of the data items of one group to some other data items in the other group. If the names of the equivalent data item