FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour even numbers and odd numbers
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
even numbers and odd numbers
Posted: Tue Mar 15, 2022 09:23 AM

is there a function to check if a number is even or odd?
thanks

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: even numbers and odd numbers
Posted: Tue Mar 15, 2022 09:42 AM
Code (fw): Select all Collapse
function IsEvenNumber( n )
return ( ( n % 2 ) == 0 )
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: even numbers and odd numbers
Posted: Tue Mar 15, 2022 10:33 AM
nageswaragunupudi wrote:
Code (fw): Select all Collapse
function IsEvenNumber( n )
return ( ( n % 2 ) == 0 )


thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: even numbers and odd numbers
Posted: Tue Mar 15, 2022 02:33 PM
As old school programmer
Code (fw): Select all Collapse
function IsEvenNumber( n )
return ( hb_bitand(n,1)  == 0 )

Continue the discussion