Ines0704
3

# Bonjour pouvez vous m'aider svp ? Le code d'un coffre-fort est une nombre à 6 chiffres qui utilise chacun des chiffres de 1 à 6 exactement une fois. On sait que le code est pair et que parmi deux chiffres consécutifs l'un est toujours multiple de l'autre. Quel est ce code ? Merci d'avance

(1) Réponses
valeriepeneaux

Bonjour, 513624 car DIM a AS INTEGER, b AS INTEGER, c AS INTEGER, d AS INTEGER, e AS INTEGER, f AS INTEGER FOR a = 1 TO 6     FOR b = 1 TO 6         IF b <> a THEN             IF a MOD b = 0 OR b MOD a = 0 THEN                 FOR c = 1 TO 6                     IF c <> b AND c <> a THEN                         IF b MOD c = 0 OR c MOD b = 0 THEN                             FOR d = 1 TO 6                                 IF d <> c AND d <> b AND d <> a THEN                                     IF c MOD d = 0 OR d MOD c = 0 THEN                                         FOR e = 1 TO 6                                             IF e <> d AND e <> c AND e <> b AND e <> a THEN                                                 IF d MOD e = 0 OR e MOD d = 0 THEN                                                     FOR f = 2 TO 6 STEP 2                                                         IF f <> e AND f <> d AND f <> c AND f <> b AND f <> a THEN                                                             IF e MOD f = 0 OR f MOD e = 0 THEN                                                                 PRINT a; b; c; d; e; f                                                             END IF                                                         END IF                                                     NEXT f                                                 END IF                                             END IF                                         NEXT e                                     END IF                                 END IF                             NEXT d                         END IF                     END IF                 NEXT c             END IF         END IF     NEXT b NEXT a END

Ajouter une réponse