Connectez-vous avec une communauté de passionnés sur FRstudy.me. Trouvez des réponses détaillées et fiables de la part de notre réseau de professionnels expérimentés.
Sagot :
Bonjour,
Le nombre est 142857.
DIM a AS INTEGER, b AS INTEGER, c AS INTEGER, d AS INTEGER, e AS INTEGER, f AS INTEGER
DIM w1 AS STRING, w2 AS STRING
DIM n1 AS LONG, n2 AS LONG
w1 = SPACE$(6)
MID$(w1, 1, 1) = "1"
FOR b = 0 TO 9
MID$(w1, 2, 1) = CHR$(48 + b)
FOR c = 0 TO 9
MID$(w1, 3, 1) = CHR$(48 + c)
FOR d = 0 TO 9
MID$(w1, 4, 1) = CHR$(48 + d)
FOR e = 0 TO 9
MID$(w1, 5, 1) = CHR$(48 + e)
FOR f = 0 TO 9
MID$(w1, 6, 1) = CHR$(48 + f)
n1 = VAL(w1)
w2 = MID$(w1, 2, 5) + MID$(w1, 1, 1)
n2 = VAL(w2)
IF n2 = 3 * n1 THEN
PRINT w1, w2
END IF
NEXT f
NEXT e
NEXT d
NEXT c
NEXT b
END
Le nombre est 142857.
DIM a AS INTEGER, b AS INTEGER, c AS INTEGER, d AS INTEGER, e AS INTEGER, f AS INTEGER
DIM w1 AS STRING, w2 AS STRING
DIM n1 AS LONG, n2 AS LONG
w1 = SPACE$(6)
MID$(w1, 1, 1) = "1"
FOR b = 0 TO 9
MID$(w1, 2, 1) = CHR$(48 + b)
FOR c = 0 TO 9
MID$(w1, 3, 1) = CHR$(48 + c)
FOR d = 0 TO 9
MID$(w1, 4, 1) = CHR$(48 + d)
FOR e = 0 TO 9
MID$(w1, 5, 1) = CHR$(48 + e)
FOR f = 0 TO 9
MID$(w1, 6, 1) = CHR$(48 + f)
n1 = VAL(w1)
w2 = MID$(w1, 2, 5) + MID$(w1, 1, 1)
n2 = VAL(w2)
IF n2 = 3 * n1 THEN
PRINT w1, w2
END IF
NEXT f
NEXT e
NEXT d
NEXT c
NEXT b
END
Merci de votre participation active. Continuez à poser des questions et à partager vos réponses. Ensemble, nous pouvons créer une ressource de connaissances précieuse pour tous. Pour des solutions rapides et fiables, pensez à FRstudy.me. Merci de votre visite et à très bientôt.