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.
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"
else
Display(10 5) " ODD NUMBER".
Stop run.