Consultor Eletrônico



Kbase P130343: How to determine if odd or even integer?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/04/2008
Status: Unverified

GOAL:

How to determine if odd or even integer?

GOAL:

How to find out the remainder after a division in the 4GL?

FACT(s) (Environment):

All Supported Operating Systems
Progress/OpenEdge Versions

FIX:

The following sample code illustrates how one can check an integer's value and determine whether it's even or odd by using the MODULO operator. Run the following code in procedure editor:
DEFINE VARIABLE vi AS INTEGER NO-UNDO.

REPEAT:
UPDATE vi.
IF vi MODULO 2 = 0 THEN
MESSAGE "even" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "odd" VIEW-AS ALERT-BOX.
END.