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
SIGN CONDITION:   The sign condition establishes whether or not the algebraic value of an operand is negative, positive or zero. The operand can be either the numeric identif

single program how may when statement has used

RULES FOR OCCURS CLAUSE: The rules apply for the OCCURS clause and the subscripts are as shown below. (1) The integer in the OCCURS clause should be a positive integer.

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

START STATEMENT: The START statement places the files to the initial logical record whose record key satisfies the condition specified by the KEY phrase. The access mode shoul

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

PROGRAM FOR PERFORM - THRU: We have to write a program to elaborate PERFORM ...THRU statement Identification division. Program- id.  Perfthru. Environment division.

Rules of read statements: The next record is identified according to the rules as shown below: (i) Whenever the READ NEXT statement is the initial statement to be executed

Rules for constructing an Arithmetic Expression: The rules for constructing an arithmetic expression are as shown below: (i) When an arithmetic expression specifies a calcu

Transaction file : A transaction file is a file which contains new records those changes to old records which are used to update the master file. The problem of file updatio