You are on page 1of 2

Feuil1 - 1

Public Sub paire()


Dim X As Double
n = InputBox("Entre la valeir")
If i Mod 2 = 0 Then
MsgBox n & " est paire"
Else
MsgBox n & " est impaire"

End If
End Sub

Public Sub somme()


n = InputBox(" Entre la valeur")
f = 0
For i = 1 To n
f = i + f
Next
MsgBox f
End Sub

Public Sub somme2()


n = InputBox(" Entre la valeur")
f = n * (n + 1) / 2
MsgBox f
End Sub

Public Sub fac()


n = InputBox(" Entre la valeur")
f = 1
For i = 1 To n
f = i * f
Next
MsgBox f
End Sub

Public Sub premier()


n = InputBox(" Entre la valeur")
i = 1

If n Mod i = n Then
MsgBox n & " nombre premier "
Else
MsgBox n & "est pas un nombre premier"
End If
i = n
If n Mod n = 1 Then
MsgBox n & " le nombre est premier "
Else
MsgBox n & " le nombre n'est pas premier"

End If
End Sub

Public Sub diviseur()


Dim n As Integer
n = InputBox(" Entrer la valeur")
result = "1"
For i = 2 To n / 2
If n Mod i = 0 Then
result = result & "," & i
End If
Next
result = "les diviseurs de " & n & " sont " & result & "," & n
MsgBox result
End Sub

Public Sub skills()

'MsgBox ActiveCell.Row & "" & ActiveCell.Column

'Cells(10, 5) = 5

'MsgBox Cells(5, 5)
l = ActiveCell.Row
C = ActiveCell.Column
Feuil1 - 2

For i = 0 To 19

Cells(l + i, C) = Cells(l + i, C - 2) + Cells(l + i, C - 1)


Next
'MsgBox ActiveCell.ColumnWidth

'MsgBox ActiveCell.RowHeight
'MsgBox ActiveCell.Interior.Color

'For i = 1 To 5

'Cells(7 + i, 8).Interior.Color = RGB(255, 0, 0)


'Cells(7, 8 + i).Interior.Color = RGB(0, 255, 0)

'Next

End Sub

Public Sub multiplication()


l = ActiveCell.Row - 1
C = ActiveCell.Column - 1

For i = 1 To 10
For j = 1 To 10
Cells(l + i, C + j) = i * j
Next
Next

End Sub

You might also like