J.M. Wilkins,
Department of Materials Science and Metallurgy,
University of Cambridge,
Cambridge, U.K.
To test if a number is odd or even.
Language: | FORTRAN |
Product form: | Source code |
MAP_UTIL_ODD tests if the number A is odd or even. Integer arithmetic is used, and the test for the evenness of A is if INT(A/2) is equal to INT((A+1)/2).
None supplied.
None.
Ideally, A should be an integer.
None.
REAL A INTEGER JODD READ (5,*) A CALL MAP_UTIL_ODD(A, JODD) IF (JODD .EQ. 0) GOTO 40 WRITE(6,10) A 10 FORMAT(F8.2, ' is odd') GOTO 60 40 WRITE(6,20) A 20 FORMAT(F8.2, ' is even') 60 CONTINUE STOP END
3.0
3.0 is odd.
None.
odd, even
MAP originated from a joint project of the National Physical Laboratory and the University of Cambridge.
MAP Website administration / map@msm.cam.ac.uk