Who can help me out with a QBASIC CODE to find the permutation of a given number. I'd really appreciate. I've tried writing some codes but it's not giving the required answer.
Asked
Active
Viewed 106 times
0
-
Hi there! You should put the question you'd like answered in your question. Simply asking who can help isn't useful since we're all here to help! :) – Robert Talada Feb 14 '20 at 06:09
-
Then help me out pls – goodluck nwofor Feb 14 '20 at 07:09
-
Does this answer your question? [Qbasic code to solve for the permutation of a given number](https://stackoverflow.com/questions/60148215/qbasic-code-to-solve-for-the-permutation-of-a-given-number) – Jimmy Smith Feb 14 '20 at 21:10
-
Please, insert your "better" code in the question! We can better understand your question and we might correct your code issues. – Sir Jo Black May 10 '20 at 16:26
1 Answers
0
If by permutation you mean the factorial then the following is the code that you need. It will get an integer and compute its factorial.
DECLARE FUNCTION Factorial (n)
FUNCTION Factorial (n)
IF n = 0 THEN
Factorial = 1
ELSE
Factorial = n * Factorial(n - 1)
END IF
END FUNCTION
INPUT "PLEASE ENTER AN INTEGER", n
PRINT n;"! = "; Factorial(n)
But if by permutation you mean all of the permutations of the sequence 1,...,n then it is another story. So let me know in the comments.

MathCoder
- 442
- 3
- 9