Paire ou impaire

JeanPhi2306 Messages postés 8 Date d'inscription mercredi 27 novembre 2002 Statut Membre Dernière intervention 25 avril 2004 - 21 avril 2003 à 17:23
JeanPhi2306 Messages postés 8 Date d'inscription mercredi 27 novembre 2002 Statut Membre Dernière intervention 25 avril 2004 - 21 avril 2003 à 18:30
Salut !

Je cherche une formule pour identifier un chiffre comme PAIRE ou IMPAIRE ( afin de pouvoir activer ou desactiver des fonctions selon la reponse )

Et je trouve pas !!!!!!!

Merci de me donner un petit coup de main !

3 réponses

stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
21 avril 2003 à 17:56
Dim test As Integer

test = 12

If test Mod 2 = 0 Then
MsgBox "pair"
Else
MsgBox "impaire"
End If
0
K@zuya Messages postés 306 Date d'inscription vendredi 21 février 2003 Statut Membre Dernière intervention 15 février 2016
21 avril 2003 à 18:01
sa peut paraitre barbare mais j'ai pas trouvé mieux que:

Dim Test As Integer
Private Sub Command1_Click()

Continu:
DoEvents
Text1.Text = Text1.Text - 2If Text1.Text 1 Then Label1.Caption "Impaire": Exit SubIf Text1.Text 0 Then Label1.Caption "Paire": Exit Sub
If Text1.Text < 0 Then Label1.Caption = "Irrationnel": Exit Sub
GoTo Continu

End Sub
0
JeanPhi2306 Messages postés 8 Date d'inscription mercredi 27 novembre 2002 Statut Membre Dernière intervention 25 avril 2004
21 avril 2003 à 18:30
MERIC BEAUCOUP DE VOTRE AIDE ! SA M4ENLEVE UNE BELLE EPINE DU PIED
0
Rejoignez-nous