[HS] Un carré magique pour la collection de GeeDee
1 réponse
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
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
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
Bonjour Serge
Magique...
Même dans l'autre sens.
JJ
"garnote" <rien@absent.net> a écrit dans le message de
news:OSo9zZbRFHA.3476@TK2MSFTNGP10.phx.gbl...
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
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