0% found this document useful (0 votes)
21 views1 page

COBOL Program for Odd/Even Check

This program accepts a number from the user, divides it by 2, and displays whether the number is odd or even based on whether the remainder is 0.

Uploaded by

Ahmed Sk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

COBOL Program for Odd/Even Check

This program accepts a number from the user, divides it by 2, and displays whether the number is odd or even based on whether the remainder is 0.

Uploaded by

Ahmed Sk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

IDENTIFICATION DIVISION.

PROGRAM-ID. AAA.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 Q PIC 9999.
77 R PIC 9999.
77 A PIC 9999.

PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER ONE NUMBER".
ACCEPT A.

DIV-PARA.
DIVIDE A BY 2 GIVING R REMAINDER Q.

DISP-PARA.
IF Q IS NOT EQUAL TO 0
DISPLAY "ODD"
ELSE
DISPLAY "EVEN".
STOP RUN.

You might also like