-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermutation.vb
50 lines (45 loc) · 1.31 KB
/
permutation.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Public Class permutation
'fade in...
Public Sub fade_In()
For fadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = fadeIn
'Me.Refresh()
Threading.Thread.Sleep(100)
Next
End Sub
'... fade out...
Public Sub fade_out()
For FadeOut = 90 To 10 Step -10
Me.Opacity = FadeOut / 100
'Me.Refresh()
Threading.Thread.Sleep(100)
Next
End Sub
Private Sub clear()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a, n, r, d, c As Long
n = Val(TextBox1.Text)
r = Val(TextBox2.Text)
Try
a = 1
For i = 1 To Val(TextBox1.Text)
a = a * i
Next i
c = 1
For i = 1 To Val(TextBox1.Text) - Val(TextBox2.Text)
c = c * i
Next i
d = a / c
MsgBox(n & "permutation" & r & "is" & d)
Catch ex As Exception
MsgBox("an error occured")
End Try
clear()
End Sub
Private Sub permutation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class