even numbers and odd numbers

even numbers and odd numbers

Postby Silvio.Falconi » Tue Mar 15, 2022 9: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 November 2023 - January 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
Silvio.Falconi
 
Posts: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: even numbers and odd numbers

Postby nageswaragunupudi » Tue Mar 15, 2022 9:42 am

Code: Select all  Expand view

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: even numbers and odd numbers

Postby Silvio.Falconi » Tue Mar 15, 2022 10:33 am

nageswaragunupudi wrote:
Code: Select all  Expand view

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


thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: even numbers and odd numbers

Postby AntoninoP » Tue Mar 15, 2022 2:33 pm

As old school programmer
Code: Select all  Expand view
function IsEvenNumber( n )
return ( hb_bitand(n,1)  == 0 )
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests