OVH Cloud OVH Cloud

[HS] Un carré magique pour la collection de GeeDee

1 réponse
Avatar
garnote
Bonjour, Bonjour,

C'est parfois un peu dingue, les mathématiques !

Option Base 1
Sub Carré_Magique_Miroir()
'Sommes = 242 pour
'96, 64, 37, ... et 69, 46, 73, ...
Dim N
Dim i As Integer, j As Integer
Dim k As Integer
Sheets.Add
Cells.RowHeight = 13
Cells.ColumnWidth = 3
N = Array(96, 64, 37, 45, 39, 43, 98, 62, 84, 76, 25, 57, 23, 59, 82, 78)
For i = 3 To 6
For j = 3 To 6
k = k + 1
Cells(i, j) = N(k)
Cells(i, j + 6) = 10 * N(k) - 99 * Int(N(k) / 10)
Next j
Next i
End Sub

Bonne journée,
Serge

1 réponse

Avatar
Jacky
Bonjour Serge

Magique...
Même dans l'autre sens.

JJ

"garnote" a écrit dans le message de
news:
Bonjour, Bonjour,

C'est parfois un peu dingue, les mathématiques !

Option Base 1
Sub Carré_Magique_Miroir()
'Sommes = 242 pour
'96, 64, 37, ... et 69, 46, 73, ...
Dim N
Dim i As Integer, j As Integer
Dim k As Integer
Sheets.Add
Cells.RowHeight = 13
Cells.ColumnWidth = 3
N = Array(96, 64, 37, 45, 39, 43, 98, 62, 84, 76, 25, 57, 23, 59, 82,
78)

For i = 3 To 6
For j = 3 To 6
k = k + 1
Cells(i, j) = N(k)
Cells(i, j + 6) = 10 * N(k) - 99 * Int(N(k) / 10)
Next j
Next i
End Sub

Bonne journée,
Serge