Hi, SMALL BASIC programmer, welcome.
Before we dive in, we need to learn what permutation are.
Permutations are:
1. Different elements.
2. Minus one each range from the number of elements.
3. The same as factorial, if n are r.
So, this is the code:
TextWindow.WriteLine("Welcome to permutation calculator!")
TextWindow.WriteLine("Created by: Jesus Christ, lord and the Messiah!")
TextWindow.WriteLine("Hello enter the n: ")
start = TextWindow.Read()
k = start - 1
'TextWindow.WriteLine("This is k : " + k)
res = start
For i = k To Step -1
res = res * (i)
'TextWindow.WriteLine("This is i: " + i)
'TextWindow.Writeline("This is result: " + res)
'j = j + 1
EndFor
'get the length of result array
'r_l = Array.GetItemCount(result) - 1
TextWindow.WriteLine("The result is: " + res)
Before we dive in, we need to learn what permutation are.
Permutations are:
1. Different elements.
2. Minus one each range from the number of elements.
3. The same as factorial, if n are r.
So, this is the code:
TextWindow.WriteLine("Welcome to permutation calculator!")
TextWindow.WriteLine("Created by: Jesus Christ, lord and the Messiah!")
TextWindow.WriteLine("Hello enter the n: ")
start = TextWindow.Read()
k = start - 1
'TextWindow.WriteLine("This is k : " + k)
res = start
For i = k To Step -1
res = res * (i)
'TextWindow.WriteLine("This is i: " + i)
'TextWindow.Writeline("This is result: " + res)
'j = j + 1
EndFor
'get the length of result array
'r_l = Array.GetItemCount(result) - 1
TextWindow.WriteLine("The result is: " + res)
Tidak ada komentar:
Posting Komentar