Jump to content

is the number odd or even


 Share

Recommended Posts

:whistle: i dont know how this can be helpful but..... here it is

#include <math.au3>
$I_Var = InputBox('Odd or Even', 'Enter a number:')
$I_Result = _MathCheckDiv($I_Var, 2)
If $I_Result = -1 Or @error = 1 Then
   MsgBox(0,'','You did not enter a valid number')
ElseIf $I_Result = 1 Then
   MsgBox(0,'','Number is odd')
ElseIf $I_Result = 2 Then
   MsgBox(0,'','Number is even')
Else
   MsgBox(0,'','Could not parse $I_Result')
EndIf

odd_or_even_real_1.au3

Edited by seargent master
Link to comment
Share on other sites

try to make it into a func :whistle:

IIRC it has been done before. but dont let that ruin you fun.

i made this a long time ago also:

Func _IsEven($i_Check)
    If StringIsDigit($i_Check) Then $i_Check = Number($i_Check)
    If Not IsNumber($i_Check) Then
        SetError(1)
        Return -1
    EndIf
    If Not IsInt($i_Check) Then Return 0
    If IsInt($i_Check / 2) Then Return 1
    Return 0
EndFunc;==> _IsEven()

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...