even numbers and odd numbers

Post Reply
User avatar
Silvio.Falconi
Posts: 7169
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 3 times

even numbers and odd numbers

Post by Silvio.Falconi »

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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: even numbers and odd numbers

Post by nageswaragunupudi »

Code: Select all | Expand


function IsEvenNumber( n )
return ( ( n % 2 ) == 0 )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7169
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 3 times

Re: even numbers and odd numbers

Post by Silvio.Falconi »

nageswaragunupudi wrote:

Code: Select all | Expand


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
AntoninoP
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: even numbers and odd numbers

Post by AntoninoP »

As old school programmer

Code: Select all | Expand

function IsEvenNumber( n )
return ( hb_bitand(n,1)  == 0 )
Post Reply