Sunday, 11 October 2009

PROGRAM BILANGAN GANJIL/GENAP PADA COBOL

PROGRAM BILANGAN GANJIL ATAU GENAP PADA COBOL

IDENTIFICATION DIVISION.
PROGRAM-ID. GANJIL.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 BILANGAN.
02 A PIC 99.
02 HASIL PIC 99 VALUE 0.
02 SISA PIC 99 VALUE 0.
02 BIL PIC X(6).
PROCEDURE DIVISION.
MULAI.
DISPLAY (1, 1) 'MASUKKAN BILANGAN : '.
ACCEPT A.
DISPLAY SPACE.
DIVIDE 2 INTO A GIVING HASIL REMAINDER SISA.
IF SISA = 0
MOVE 'GENAP' TO BIL
ELSE
MOVE 'GANJIL' TO BIL.
DISPLAY A, ' ADALAH BILANGAN ', BIL.
SELESAI.
STOP RUN.


OUTPUT :

MASUKKAN BILANGAN : 13
13 ADALAH BILANGAN GANJIL

Posting Terkait

0 comments:

Post a Comment

Mikail Alfith Amarullah

↑ Grab this Headline Animator

IKLAN

  © Blogger Tamplates

Back to TOP